(* Content-type: application/vnd.wolfram.mathematica *)

(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)

(* CreatedBy='Mathematica 9.0' *)

(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[       157,          7]
NotebookDataLength[    118481,       2912]
NotebookOptionsPosition[    117140,       2867]
NotebookOutlinePosition[    117478,       2882]
CellTagsIndexPosition[    117435,       2879]
WindowFrame->Normal*)

(* Beginning of Notebook Content *)
Notebook[{

Cell[CellGroupData[{
Cell[BoxData[{
 RowBox[{"X", "=", 
  RowBox[{"{", 
   RowBox[{
    RowBox[{"{", "xk0", "}"}], ",", 
    RowBox[{"{", "xk1", "}"}]}], "}"}]}], "\[IndentingNewLine]", 
 RowBox[{"U", "=", " ", 
  RowBox[{"Transpose", "[", 
   RowBox[{"{", 
    RowBox[{"{", 
     RowBox[{"uk", ",", "uk1"}], "}"}], "}"}], "]"}]}], "\[IndentingNewLine]", 
 RowBox[{"TH", "=", 
  RowBox[{"{", 
   RowBox[{
    RowBox[{"{", "1", "}"}], ",", 
    RowBox[{"{", "1", "}"}]}], "}"}]}], "\[IndentingNewLine]", 
 RowBox[{"GA", " ", "=", " ", 
  RowBox[{"{", 
   RowBox[{
    RowBox[{"{", 
     RowBox[{"0", ",", "0"}], "}"}], ",", 
    RowBox[{"{", 
     RowBox[{"1", ",", "0"}], "}"}]}], "}"}]}], "\[IndentingNewLine]", 
 RowBox[{"Qm", "=", 
  RowBox[{"{", 
   RowBox[{
    RowBox[{"{", 
     RowBox[{"Q", " ", ",", "0"}], "}"}], ",", 
    RowBox[{"{", 
     RowBox[{"0", ",", " ", "Q"}], "}"}]}], "}"}]}], "\[IndentingNewLine]", 
 RowBox[{"Rm", "=", " ", 
  RowBox[{"{", 
   RowBox[{
    RowBox[{"{", 
     RowBox[{"R", ",", "0"}], "}"}], ",", 
    RowBox[{"{", 
     RowBox[{"0", ",", "R"}], "}"}]}], "}"}]}], "\[IndentingNewLine]", 
 RowBox[{"EPSu", "=", 
  RowBox[{"{", 
   RowBox[{
    RowBox[{"{", 
     RowBox[{"1", ",", "0"}], "}"}], ",", 
    RowBox[{"{", 
     RowBox[{"0", ",", "1"}], "}"}], ",", 
    RowBox[{"{", 
     RowBox[{
      RowBox[{"-", "1"}], ",", "0"}], "}"}], ",", 
    RowBox[{"{", 
     RowBox[{"0", ",", 
      RowBox[{"-", "1"}]}], "}"}]}], "}"}]}], "\[IndentingNewLine]", 
 RowBox[{"Fu", " ", "=", 
  RowBox[{"Transpose", "[", 
   RowBox[{"{", 
    RowBox[{"{", 
     RowBox[{"1", ",", "1", ",", "1", ",", "1"}], "}"}], "}"}], 
   "]"}]}], "\[IndentingNewLine]"}], "Input",
 CellChangeTimes->{{3.594730475124049*^9, 3.5947305392418623`*^9}, {
  3.594730570671093*^9, 3.5947306345854397`*^9}, {3.59473070176647*^9, 
  3.594730711062235*^9}, {3.594730754052724*^9, 3.594730821830225*^9}, {
  3.5947974037916727`*^9, 3.594797423987562*^9}, {3.594799916939152*^9, 
  3.594799921892312*^9}, {3.594799967859482*^9, 3.594800035614581*^9}}],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{
   RowBox[{"{", "xk0", "}"}], ",", 
   RowBox[{"{", "xk1", "}"}]}], "}"}]], "Output",
 CellChangeTimes->{
  3.5947308708111*^9, {3.5947311082062607`*^9, 3.594731203978039*^9}, {
   3.594731270694522*^9, 3.594731289081444*^9}, 3.594731634653818*^9, 
   3.594731798997692*^9, 3.594731917577281*^9, 3.594731997319104*^9, 
   3.594732027863183*^9, 3.5947322096831083`*^9, {3.594732259498117*^9, 
   3.594732284657847*^9}, 3.594732911620235*^9, {3.5947329507107964`*^9, 
   3.594732969522931*^9}, 3.5947330466488943`*^9, 3.594733094607293*^9, 
   3.594733181620874*^9, {3.594733348850004*^9, 3.594733356668273*^9}, 
   3.594733392928997*^9, 3.5947335151740627`*^9, 3.594733706256569*^9, 
   3.594797440933427*^9, 3.594797528868189*^9, 3.594797644797337*^9, 
   3.594797707378561*^9, 3.594797750092074*^9, {3.5947978254132*^9, 
   3.594797844509841*^9}, {3.594797983753578*^9, 3.594798033900691*^9}, 
   3.594798106996276*^9, {3.59479813717374*^9, 3.5947981845977297`*^9}, {
   3.5947982307566833`*^9, 3.594798245087163*^9}, 3.594798337303397*^9, 
   3.594798395040436*^9, 3.5947987749956703`*^9, 3.5947988794649963`*^9, 
   3.594798994873551*^9, {3.594799348081312*^9, 3.594799370581599*^9}, 
   3.5947994378728228`*^9, {3.594799724474197*^9, 3.5947997430485*^9}, 
   3.594799801958736*^9, {3.594799870489768*^9, 3.594799905018303*^9}, 
   3.59479993557554*^9, {3.5947999708751507`*^9, 3.594800024613329*^9}, 
   3.59480006034934*^9, 3.594800191180606*^9, 3.594800437282671*^9, 
   3.594800502236745*^9, 3.594800793789653*^9, {3.594800841256839*^9, 
   3.594800860748239*^9}, 3.594800909856892*^9}],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{
   RowBox[{"{", "uk", "}"}], ",", 
   RowBox[{"{", "uk1", "}"}]}], "}"}]], "Output",
 CellChangeTimes->{
  3.5947308708111*^9, {3.5947311082062607`*^9, 3.594731203978039*^9}, {
   3.594731270694522*^9, 3.594731289081444*^9}, 3.594731634653818*^9, 
   3.594731798997692*^9, 3.594731917577281*^9, 3.594731997319104*^9, 
   3.594732027863183*^9, 3.5947322096831083`*^9, {3.594732259498117*^9, 
   3.594732284657847*^9}, 3.594732911620235*^9, {3.5947329507107964`*^9, 
   3.594732969522931*^9}, 3.5947330466488943`*^9, 3.594733094607293*^9, 
   3.594733181620874*^9, {3.594733348850004*^9, 3.594733356668273*^9}, 
   3.594733392928997*^9, 3.5947335151740627`*^9, 3.594733706256569*^9, 
   3.594797440933427*^9, 3.594797528868189*^9, 3.594797644797337*^9, 
   3.594797707378561*^9, 3.594797750092074*^9, {3.5947978254132*^9, 
   3.594797844509841*^9}, {3.594797983753578*^9, 3.594798033900691*^9}, 
   3.594798106996276*^9, {3.59479813717374*^9, 3.5947981845977297`*^9}, {
   3.5947982307566833`*^9, 3.594798245087163*^9}, 3.594798337303397*^9, 
   3.594798395040436*^9, 3.5947987749956703`*^9, 3.5947988794649963`*^9, 
   3.594798994873551*^9, {3.594799348081312*^9, 3.594799370581599*^9}, 
   3.5947994378728228`*^9, {3.594799724474197*^9, 3.5947997430485*^9}, 
   3.594799801958736*^9, {3.594799870489768*^9, 3.594799905018303*^9}, 
   3.59479993557554*^9, {3.5947999708751507`*^9, 3.594800024613329*^9}, 
   3.59480006034934*^9, 3.594800191180606*^9, 3.594800437282671*^9, 
   3.594800502236745*^9, 3.594800793789653*^9, {3.594800841256839*^9, 
   3.594800860748239*^9}, 3.594800909858561*^9}],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{
   RowBox[{"{", "1", "}"}], ",", 
   RowBox[{"{", "1", "}"}]}], "}"}]], "Output",
 CellChangeTimes->{
  3.5947308708111*^9, {3.5947311082062607`*^9, 3.594731203978039*^9}, {
   3.594731270694522*^9, 3.594731289081444*^9}, 3.594731634653818*^9, 
   3.594731798997692*^9, 3.594731917577281*^9, 3.594731997319104*^9, 
   3.594732027863183*^9, 3.5947322096831083`*^9, {3.594732259498117*^9, 
   3.594732284657847*^9}, 3.594732911620235*^9, {3.5947329507107964`*^9, 
   3.594732969522931*^9}, 3.5947330466488943`*^9, 3.594733094607293*^9, 
   3.594733181620874*^9, {3.594733348850004*^9, 3.594733356668273*^9}, 
   3.594733392928997*^9, 3.5947335151740627`*^9, 3.594733706256569*^9, 
   3.594797440933427*^9, 3.594797528868189*^9, 3.594797644797337*^9, 
   3.594797707378561*^9, 3.594797750092074*^9, {3.5947978254132*^9, 
   3.594797844509841*^9}, {3.594797983753578*^9, 3.594798033900691*^9}, 
   3.594798106996276*^9, {3.59479813717374*^9, 3.5947981845977297`*^9}, {
   3.5947982307566833`*^9, 3.594798245087163*^9}, 3.594798337303397*^9, 
   3.594798395040436*^9, 3.5947987749956703`*^9, 3.5947988794649963`*^9, 
   3.594798994873551*^9, {3.594799348081312*^9, 3.594799370581599*^9}, 
   3.5947994378728228`*^9, {3.594799724474197*^9, 3.5947997430485*^9}, 
   3.594799801958736*^9, {3.594799870489768*^9, 3.594799905018303*^9}, 
   3.59479993557554*^9, {3.5947999708751507`*^9, 3.594800024613329*^9}, 
   3.59480006034934*^9, 3.594800191180606*^9, 3.594800437282671*^9, 
   3.594800502236745*^9, 3.594800793789653*^9, {3.594800841256839*^9, 
   3.594800860748239*^9}, 3.594800909860208*^9}],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{
   RowBox[{"{", 
    RowBox[{"0", ",", "0"}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{"1", ",", "0"}], "}"}]}], "}"}]], "Output",
 CellChangeTimes->{
  3.5947308708111*^9, {3.5947311082062607`*^9, 3.594731203978039*^9}, {
   3.594731270694522*^9, 3.594731289081444*^9}, 3.594731634653818*^9, 
   3.594731798997692*^9, 3.594731917577281*^9, 3.594731997319104*^9, 
   3.594732027863183*^9, 3.5947322096831083`*^9, {3.594732259498117*^9, 
   3.594732284657847*^9}, 3.594732911620235*^9, {3.5947329507107964`*^9, 
   3.594732969522931*^9}, 3.5947330466488943`*^9, 3.594733094607293*^9, 
   3.594733181620874*^9, {3.594733348850004*^9, 3.594733356668273*^9}, 
   3.594733392928997*^9, 3.5947335151740627`*^9, 3.594733706256569*^9, 
   3.594797440933427*^9, 3.594797528868189*^9, 3.594797644797337*^9, 
   3.594797707378561*^9, 3.594797750092074*^9, {3.5947978254132*^9, 
   3.594797844509841*^9}, {3.594797983753578*^9, 3.594798033900691*^9}, 
   3.594798106996276*^9, {3.59479813717374*^9, 3.5947981845977297`*^9}, {
   3.5947982307566833`*^9, 3.594798245087163*^9}, 3.594798337303397*^9, 
   3.594798395040436*^9, 3.5947987749956703`*^9, 3.5947988794649963`*^9, 
   3.594798994873551*^9, {3.594799348081312*^9, 3.594799370581599*^9}, 
   3.5947994378728228`*^9, {3.594799724474197*^9, 3.5947997430485*^9}, 
   3.594799801958736*^9, {3.594799870489768*^9, 3.594799905018303*^9}, 
   3.59479993557554*^9, {3.5947999708751507`*^9, 3.594800024613329*^9}, 
   3.59480006034934*^9, 3.594800191180606*^9, 3.594800437282671*^9, 
   3.594800502236745*^9, 3.594800793789653*^9, {3.594800841256839*^9, 
   3.594800860748239*^9}, 3.5948009098618803`*^9}],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{
   RowBox[{"{", 
    RowBox[{"Q", ",", "0"}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{"0", ",", "Q"}], "}"}]}], "}"}]], "Output",
 CellChangeTimes->{
  3.5947308708111*^9, {3.5947311082062607`*^9, 3.594731203978039*^9}, {
   3.594731270694522*^9, 3.594731289081444*^9}, 3.594731634653818*^9, 
   3.594731798997692*^9, 3.594731917577281*^9, 3.594731997319104*^9, 
   3.594732027863183*^9, 3.5947322096831083`*^9, {3.594732259498117*^9, 
   3.594732284657847*^9}, 3.594732911620235*^9, {3.5947329507107964`*^9, 
   3.594732969522931*^9}, 3.5947330466488943`*^9, 3.594733094607293*^9, 
   3.594733181620874*^9, {3.594733348850004*^9, 3.594733356668273*^9}, 
   3.594733392928997*^9, 3.5947335151740627`*^9, 3.594733706256569*^9, 
   3.594797440933427*^9, 3.594797528868189*^9, 3.594797644797337*^9, 
   3.594797707378561*^9, 3.594797750092074*^9, {3.5947978254132*^9, 
   3.594797844509841*^9}, {3.594797983753578*^9, 3.594798033900691*^9}, 
   3.594798106996276*^9, {3.59479813717374*^9, 3.5947981845977297`*^9}, {
   3.5947982307566833`*^9, 3.594798245087163*^9}, 3.594798337303397*^9, 
   3.594798395040436*^9, 3.5947987749956703`*^9, 3.5947988794649963`*^9, 
   3.594798994873551*^9, {3.594799348081312*^9, 3.594799370581599*^9}, 
   3.5947994378728228`*^9, {3.594799724474197*^9, 3.5947997430485*^9}, 
   3.594799801958736*^9, {3.594799870489768*^9, 3.594799905018303*^9}, 
   3.59479993557554*^9, {3.5947999708751507`*^9, 3.594800024613329*^9}, 
   3.59480006034934*^9, 3.594800191180606*^9, 3.594800437282671*^9, 
   3.594800502236745*^9, 3.594800793789653*^9, {3.594800841256839*^9, 
   3.594800860748239*^9}, 3.5948009098635406`*^9}],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{
   RowBox[{"{", 
    RowBox[{"R", ",", "0"}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{"0", ",", "R"}], "}"}]}], "}"}]], "Output",
 CellChangeTimes->{
  3.5947308708111*^9, {3.5947311082062607`*^9, 3.594731203978039*^9}, {
   3.594731270694522*^9, 3.594731289081444*^9}, 3.594731634653818*^9, 
   3.594731798997692*^9, 3.594731917577281*^9, 3.594731997319104*^9, 
   3.594732027863183*^9, 3.5947322096831083`*^9, {3.594732259498117*^9, 
   3.594732284657847*^9}, 3.594732911620235*^9, {3.5947329507107964`*^9, 
   3.594732969522931*^9}, 3.5947330466488943`*^9, 3.594733094607293*^9, 
   3.594733181620874*^9, {3.594733348850004*^9, 3.594733356668273*^9}, 
   3.594733392928997*^9, 3.5947335151740627`*^9, 3.594733706256569*^9, 
   3.594797440933427*^9, 3.594797528868189*^9, 3.594797644797337*^9, 
   3.594797707378561*^9, 3.594797750092074*^9, {3.5947978254132*^9, 
   3.594797844509841*^9}, {3.594797983753578*^9, 3.594798033900691*^9}, 
   3.594798106996276*^9, {3.59479813717374*^9, 3.5947981845977297`*^9}, {
   3.5947982307566833`*^9, 3.594798245087163*^9}, 3.594798337303397*^9, 
   3.594798395040436*^9, 3.5947987749956703`*^9, 3.5947988794649963`*^9, 
   3.594798994873551*^9, {3.594799348081312*^9, 3.594799370581599*^9}, 
   3.5947994378728228`*^9, {3.594799724474197*^9, 3.5947997430485*^9}, 
   3.594799801958736*^9, {3.594799870489768*^9, 3.594799905018303*^9}, 
   3.59479993557554*^9, {3.5947999708751507`*^9, 3.594800024613329*^9}, 
   3.59480006034934*^9, 3.594800191180606*^9, 3.594800437282671*^9, 
   3.594800502236745*^9, 3.594800793789653*^9, {3.594800841256839*^9, 
   3.594800860748239*^9}, 3.594800909865273*^9}],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{
   RowBox[{"{", 
    RowBox[{"1", ",", "0"}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{"0", ",", "1"}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{
     RowBox[{"-", "1"}], ",", "0"}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{"0", ",", 
     RowBox[{"-", "1"}]}], "}"}]}], "}"}]], "Output",
 CellChangeTimes->{
  3.5947308708111*^9, {3.5947311082062607`*^9, 3.594731203978039*^9}, {
   3.594731270694522*^9, 3.594731289081444*^9}, 3.594731634653818*^9, 
   3.594731798997692*^9, 3.594731917577281*^9, 3.594731997319104*^9, 
   3.594732027863183*^9, 3.5947322096831083`*^9, {3.594732259498117*^9, 
   3.594732284657847*^9}, 3.594732911620235*^9, {3.5947329507107964`*^9, 
   3.594732969522931*^9}, 3.5947330466488943`*^9, 3.594733094607293*^9, 
   3.594733181620874*^9, {3.594733348850004*^9, 3.594733356668273*^9}, 
   3.594733392928997*^9, 3.5947335151740627`*^9, 3.594733706256569*^9, 
   3.594797440933427*^9, 3.594797528868189*^9, 3.594797644797337*^9, 
   3.594797707378561*^9, 3.594797750092074*^9, {3.5947978254132*^9, 
   3.594797844509841*^9}, {3.594797983753578*^9, 3.594798033900691*^9}, 
   3.594798106996276*^9, {3.59479813717374*^9, 3.5947981845977297`*^9}, {
   3.5947982307566833`*^9, 3.594798245087163*^9}, 3.594798337303397*^9, 
   3.594798395040436*^9, 3.5947987749956703`*^9, 3.5947988794649963`*^9, 
   3.594798994873551*^9, {3.594799348081312*^9, 3.594799370581599*^9}, 
   3.5947994378728228`*^9, {3.594799724474197*^9, 3.5947997430485*^9}, 
   3.594799801958736*^9, {3.594799870489768*^9, 3.594799905018303*^9}, 
   3.59479993557554*^9, {3.5947999708751507`*^9, 3.594800024613329*^9}, 
   3.59480006034934*^9, 3.594800191180606*^9, 3.594800437282671*^9, 
   3.594800502236745*^9, 3.594800793789653*^9, {3.594800841256839*^9, 
   3.594800860748239*^9}, 3.5948009098669443`*^9}],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{
   RowBox[{"{", "1", "}"}], ",", 
   RowBox[{"{", "1", "}"}], ",", 
   RowBox[{"{", "1", "}"}], ",", 
   RowBox[{"{", "1", "}"}]}], "}"}]], "Output",
 CellChangeTimes->{
  3.5947308708111*^9, {3.5947311082062607`*^9, 3.594731203978039*^9}, {
   3.594731270694522*^9, 3.594731289081444*^9}, 3.594731634653818*^9, 
   3.594731798997692*^9, 3.594731917577281*^9, 3.594731997319104*^9, 
   3.594732027863183*^9, 3.5947322096831083`*^9, {3.594732259498117*^9, 
   3.594732284657847*^9}, 3.594732911620235*^9, {3.5947329507107964`*^9, 
   3.594732969522931*^9}, 3.5947330466488943`*^9, 3.594733094607293*^9, 
   3.594733181620874*^9, {3.594733348850004*^9, 3.594733356668273*^9}, 
   3.594733392928997*^9, 3.5947335151740627`*^9, 3.594733706256569*^9, 
   3.594797440933427*^9, 3.594797528868189*^9, 3.594797644797337*^9, 
   3.594797707378561*^9, 3.594797750092074*^9, {3.5947978254132*^9, 
   3.594797844509841*^9}, {3.594797983753578*^9, 3.594798033900691*^9}, 
   3.594798106996276*^9, {3.59479813717374*^9, 3.5947981845977297`*^9}, {
   3.5947982307566833`*^9, 3.594798245087163*^9}, 3.594798337303397*^9, 
   3.594798395040436*^9, 3.5947987749956703`*^9, 3.5947988794649963`*^9, 
   3.594798994873551*^9, {3.594799348081312*^9, 3.594799370581599*^9}, 
   3.5947994378728228`*^9, {3.594799724474197*^9, 3.5947997430485*^9}, 
   3.594799801958736*^9, {3.594799870489768*^9, 3.594799905018303*^9}, 
   3.59479993557554*^9, {3.5947999708751507`*^9, 3.594800024613329*^9}, 
   3.59480006034934*^9, 3.594800191180606*^9, 3.594800437282671*^9, 
   3.594800502236745*^9, 3.594800793789653*^9, {3.594800841256839*^9, 
   3.594800860748239*^9}, 3.5948009098685303`*^9}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[{
 RowBox[{"H", "=", " ", 
  RowBox[{
   RowBox[{
    RowBox[{"Transpose", "[", "GA", "]"}], ".", "Qm", ".", "GA"}], "+", 
   "Rm"}]}], "\[IndentingNewLine]", 
 RowBox[{"F", "=", 
  RowBox[{
   RowBox[{"Transpose", "[", "GA", "]"}], ".", "Qm", ".", 
   "TH"}]}], "\[IndentingNewLine]", 
 RowBox[{"z", "=", 
  RowBox[{
   RowBox[{"Sqrt", "[", "2", "]"}], 
   RowBox[{"(", 
    RowBox[{"U", "+", 
     RowBox[{
      RowBox[{
       RowBox[{"Inverse", "[", "H", "]"}], ".", "F"}], " ", "xk0"}]}], 
    ")"}]}]}], "\[IndentingNewLine]", 
 RowBox[{"G", " ", "=", " ", 
  RowBox[{
   RowBox[{"1", "/", 
    RowBox[{"Sqrt", "[", "2", "]"}]}], "EPSu"}]}], "\[IndentingNewLine]", 
 RowBox[{"S", "=", 
  RowBox[{"EPSu", ".", 
   RowBox[{"Inverse", "[", "H", "]"}], ".", "F"}]}], "\[IndentingNewLine]", 
 RowBox[{"w", " ", "=", " ", "Fu"}]}], "Input",
 CellChangeTimes->{{3.594730833088138*^9, 3.5947308681544*^9}, {
   3.594730929795953*^9, 3.594731025524575*^9}, {3.5947310788509283`*^9, 
   3.594731084940164*^9}, {3.594731121708643*^9, 3.5947311422988663`*^9}, {
   3.594731174451416*^9, 3.59473120130534*^9}, {3.594731265391116*^9, 
   3.594731430103763*^9}, {3.594732903283161*^9, 3.594732909108235*^9}, {
   3.5947329424891357`*^9, 3.594732966344849*^9}, 3.594733091183642*^9, 
   3.594733178345804*^9, {3.594733341882216*^9, 3.594733342521449*^9}, {
   3.5947333846252337`*^9, 3.594733387271577*^9}, {3.5947335062917213`*^9, 
   3.594733507785742*^9}, {3.5947974314148207`*^9, 3.594797434597891*^9}, {
   3.59479800981734*^9, 3.594798044511714*^9}, {3.594799867028668*^9, 
   3.5947999301759977`*^9}, 3.59480004152384*^9}],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{
   RowBox[{"{", 
    RowBox[{
     RowBox[{"Q", "+", "R"}], ",", "0"}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{"0", ",", "R"}], "}"}]}], "}"}]], "Output",
 CellChangeTimes->{
  3.594730477613902*^9, {3.594730542191864*^9, 3.594730577848012*^9}, 
   3.594730714052774*^9, {3.594730760196371*^9, 3.594730795585177*^9}, 
   3.594730870885312*^9, {3.594731108266922*^9, 3.594731204047677*^9}, {
   3.594731270765168*^9, 3.594731289142494*^9}, 3.5947316347241173`*^9, 
   3.59473179907893*^9, 3.594731917739808*^9, 3.59473199742257*^9, 
   3.594732028069702*^9, 3.594732209888624*^9, {3.59473225968292*^9, 
   3.594732284871112*^9}, 3.5947329117844257`*^9, {3.594732950913261*^9, 
   3.594732969696723*^9}, {3.594733046872335*^9, 3.5947330618464127`*^9}, 
   3.594733094795782*^9, 3.594733181834568*^9, {3.594733344285214*^9, 
   3.594733356861854*^9}, {3.5947333895034933`*^9, 3.594733393121913*^9}, 
   3.594733515390991*^9, 3.594733706399859*^9, 3.594797441073186*^9, 
   3.594797529046836*^9, 3.594797644953837*^9, 3.594797707530582*^9, 
   3.594797750235661*^9, {3.594797825546906*^9, 3.5947978446616707`*^9}, {
   3.5947979839018307`*^9, 3.594798034034913*^9}, 3.594798107161086*^9, {
   3.5947981372429857`*^9, 3.5947981846963577`*^9}, {3.5947982309039297`*^9, 
   3.594798245173884*^9}, 3.5947983374800367`*^9, 3.594798395210162*^9, 
   3.594798775094903*^9, 3.594798879621613*^9, 3.59479899501974*^9, {
   3.594799348239743*^9, 3.594799370673485*^9}, 3.594799438041315*^9, {
   3.594799724639913*^9, 3.5947997432222157`*^9}, 3.594799802116107*^9, {
   3.594799870701089*^9, 3.594799905171001*^9}, 3.5947999710012608`*^9, {
   3.594800001149868*^9, 3.594800024780023*^9}, 3.5948000605406227`*^9, 
   3.594800191361587*^9, 3.594800437426289*^9, 3.594800502401843*^9, 
   3.594800793943123*^9, {3.59480084141462*^9, 3.594800860918365*^9}, 
   3.594800909954904*^9}],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{
   RowBox[{"{", "Q", "}"}], ",", 
   RowBox[{"{", "0", "}"}]}], "}"}]], "Output",
 CellChangeTimes->{
  3.594730477613902*^9, {3.594730542191864*^9, 3.594730577848012*^9}, 
   3.594730714052774*^9, {3.594730760196371*^9, 3.594730795585177*^9}, 
   3.594730870885312*^9, {3.594731108266922*^9, 3.594731204047677*^9}, {
   3.594731270765168*^9, 3.594731289142494*^9}, 3.5947316347241173`*^9, 
   3.59473179907893*^9, 3.594731917739808*^9, 3.59473199742257*^9, 
   3.594732028069702*^9, 3.594732209888624*^9, {3.59473225968292*^9, 
   3.594732284871112*^9}, 3.5947329117844257`*^9, {3.594732950913261*^9, 
   3.594732969696723*^9}, {3.594733046872335*^9, 3.5947330618464127`*^9}, 
   3.594733094795782*^9, 3.594733181834568*^9, {3.594733344285214*^9, 
   3.594733356861854*^9}, {3.5947333895034933`*^9, 3.594733393121913*^9}, 
   3.594733515390991*^9, 3.594733706399859*^9, 3.594797441073186*^9, 
   3.594797529046836*^9, 3.594797644953837*^9, 3.594797707530582*^9, 
   3.594797750235661*^9, {3.594797825546906*^9, 3.5947978446616707`*^9}, {
   3.5947979839018307`*^9, 3.594798034034913*^9}, 3.594798107161086*^9, {
   3.5947981372429857`*^9, 3.5947981846963577`*^9}, {3.5947982309039297`*^9, 
   3.594798245173884*^9}, 3.5947983374800367`*^9, 3.594798395210162*^9, 
   3.594798775094903*^9, 3.594798879621613*^9, 3.59479899501974*^9, {
   3.594799348239743*^9, 3.594799370673485*^9}, 3.594799438041315*^9, {
   3.594799724639913*^9, 3.5947997432222157`*^9}, 3.594799802116107*^9, {
   3.594799870701089*^9, 3.594799905171001*^9}, 3.5947999710012608`*^9, {
   3.594800001149868*^9, 3.594800024780023*^9}, 3.5948000605406227`*^9, 
   3.594800191361587*^9, 3.594800437426289*^9, 3.594800502401843*^9, 
   3.594800793943123*^9, {3.59480084141462*^9, 3.594800860918365*^9}, 
   3.594800909956506*^9}],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{
   RowBox[{"{", 
    RowBox[{
     SqrtBox["2"], " ", 
     RowBox[{"(", 
      RowBox[{"uk", "+", 
       FractionBox[
        RowBox[{"Q", " ", "R", " ", "xk0"}], 
        RowBox[{
         RowBox[{"Q", " ", "R"}], "+", 
         SuperscriptBox["R", "2"]}]]}], ")"}]}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{
     SqrtBox["2"], " ", "uk1"}], "}"}]}], "}"}]], "Output",
 CellChangeTimes->{
  3.594730477613902*^9, {3.594730542191864*^9, 3.594730577848012*^9}, 
   3.594730714052774*^9, {3.594730760196371*^9, 3.594730795585177*^9}, 
   3.594730870885312*^9, {3.594731108266922*^9, 3.594731204047677*^9}, {
   3.594731270765168*^9, 3.594731289142494*^9}, 3.5947316347241173`*^9, 
   3.59473179907893*^9, 3.594731917739808*^9, 3.59473199742257*^9, 
   3.594732028069702*^9, 3.594732209888624*^9, {3.59473225968292*^9, 
   3.594732284871112*^9}, 3.5947329117844257`*^9, {3.594732950913261*^9, 
   3.594732969696723*^9}, {3.594733046872335*^9, 3.5947330618464127`*^9}, 
   3.594733094795782*^9, 3.594733181834568*^9, {3.594733344285214*^9, 
   3.594733356861854*^9}, {3.5947333895034933`*^9, 3.594733393121913*^9}, 
   3.594733515390991*^9, 3.594733706399859*^9, 3.594797441073186*^9, 
   3.594797529046836*^9, 3.594797644953837*^9, 3.594797707530582*^9, 
   3.594797750235661*^9, {3.594797825546906*^9, 3.5947978446616707`*^9}, {
   3.5947979839018307`*^9, 3.594798034034913*^9}, 3.594798107161086*^9, {
   3.5947981372429857`*^9, 3.5947981846963577`*^9}, {3.5947982309039297`*^9, 
   3.594798245173884*^9}, 3.5947983374800367`*^9, 3.594798395210162*^9, 
   3.594798775094903*^9, 3.594798879621613*^9, 3.59479899501974*^9, {
   3.594799348239743*^9, 3.594799370673485*^9}, 3.594799438041315*^9, {
   3.594799724639913*^9, 3.5947997432222157`*^9}, 3.594799802116107*^9, {
   3.594799870701089*^9, 3.594799905171001*^9}, 3.5947999710012608`*^9, {
   3.594800001149868*^9, 3.594800024780023*^9}, 3.5948000605406227`*^9, 
   3.594800191361587*^9, 3.594800437426289*^9, 3.594800502401843*^9, 
   3.594800793943123*^9, {3.59480084141462*^9, 3.594800860918365*^9}, 
   3.594800909958227*^9}],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{
   RowBox[{"{", 
    RowBox[{
     FractionBox["1", 
      SqrtBox["2"]], ",", "0"}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{"0", ",", 
     FractionBox["1", 
      SqrtBox["2"]]}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{
     RowBox[{"-", 
      FractionBox["1", 
       SqrtBox["2"]]}], ",", "0"}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{"0", ",", 
     RowBox[{"-", 
      FractionBox["1", 
       SqrtBox["2"]]}]}], "}"}]}], "}"}]], "Output",
 CellChangeTimes->{
  3.594730477613902*^9, {3.594730542191864*^9, 3.594730577848012*^9}, 
   3.594730714052774*^9, {3.594730760196371*^9, 3.594730795585177*^9}, 
   3.594730870885312*^9, {3.594731108266922*^9, 3.594731204047677*^9}, {
   3.594731270765168*^9, 3.594731289142494*^9}, 3.5947316347241173`*^9, 
   3.59473179907893*^9, 3.594731917739808*^9, 3.59473199742257*^9, 
   3.594732028069702*^9, 3.594732209888624*^9, {3.59473225968292*^9, 
   3.594732284871112*^9}, 3.5947329117844257`*^9, {3.594732950913261*^9, 
   3.594732969696723*^9}, {3.594733046872335*^9, 3.5947330618464127`*^9}, 
   3.594733094795782*^9, 3.594733181834568*^9, {3.594733344285214*^9, 
   3.594733356861854*^9}, {3.5947333895034933`*^9, 3.594733393121913*^9}, 
   3.594733515390991*^9, 3.594733706399859*^9, 3.594797441073186*^9, 
   3.594797529046836*^9, 3.594797644953837*^9, 3.594797707530582*^9, 
   3.594797750235661*^9, {3.594797825546906*^9, 3.5947978446616707`*^9}, {
   3.5947979839018307`*^9, 3.594798034034913*^9}, 3.594798107161086*^9, {
   3.5947981372429857`*^9, 3.5947981846963577`*^9}, {3.5947982309039297`*^9, 
   3.594798245173884*^9}, 3.5947983374800367`*^9, 3.594798395210162*^9, 
   3.594798775094903*^9, 3.594798879621613*^9, 3.59479899501974*^9, {
   3.594799348239743*^9, 3.594799370673485*^9}, 3.594799438041315*^9, {
   3.594799724639913*^9, 3.5947997432222157`*^9}, 3.594799802116107*^9, {
   3.594799870701089*^9, 3.594799905171001*^9}, 3.5947999710012608`*^9, {
   3.594800001149868*^9, 3.594800024780023*^9}, 3.5948000605406227`*^9, 
   3.594800191361587*^9, 3.594800437426289*^9, 3.594800502401843*^9, 
   3.594800793943123*^9, {3.59480084141462*^9, 3.594800860918365*^9}, 
   3.59480090995996*^9}],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{
   RowBox[{"{", 
    FractionBox[
     RowBox[{"Q", " ", "R"}], 
     RowBox[{
      RowBox[{"Q", " ", "R"}], "+", 
      SuperscriptBox["R", "2"]}]], "}"}], ",", 
   RowBox[{"{", "0", "}"}], ",", 
   RowBox[{"{", 
    RowBox[{"-", 
     FractionBox[
      RowBox[{"Q", " ", "R"}], 
      RowBox[{
       RowBox[{"Q", " ", "R"}], "+", 
       SuperscriptBox["R", "2"]}]]}], "}"}], ",", 
   RowBox[{"{", "0", "}"}]}], "}"}]], "Output",
 CellChangeTimes->{
  3.594730477613902*^9, {3.594730542191864*^9, 3.594730577848012*^9}, 
   3.594730714052774*^9, {3.594730760196371*^9, 3.594730795585177*^9}, 
   3.594730870885312*^9, {3.594731108266922*^9, 3.594731204047677*^9}, {
   3.594731270765168*^9, 3.594731289142494*^9}, 3.5947316347241173`*^9, 
   3.59473179907893*^9, 3.594731917739808*^9, 3.59473199742257*^9, 
   3.594732028069702*^9, 3.594732209888624*^9, {3.59473225968292*^9, 
   3.594732284871112*^9}, 3.5947329117844257`*^9, {3.594732950913261*^9, 
   3.594732969696723*^9}, {3.594733046872335*^9, 3.5947330618464127`*^9}, 
   3.594733094795782*^9, 3.594733181834568*^9, {3.594733344285214*^9, 
   3.594733356861854*^9}, {3.5947333895034933`*^9, 3.594733393121913*^9}, 
   3.594733515390991*^9, 3.594733706399859*^9, 3.594797441073186*^9, 
   3.594797529046836*^9, 3.594797644953837*^9, 3.594797707530582*^9, 
   3.594797750235661*^9, {3.594797825546906*^9, 3.5947978446616707`*^9}, {
   3.5947979839018307`*^9, 3.594798034034913*^9}, 3.594798107161086*^9, {
   3.5947981372429857`*^9, 3.5947981846963577`*^9}, {3.5947982309039297`*^9, 
   3.594798245173884*^9}, 3.5947983374800367`*^9, 3.594798395210162*^9, 
   3.594798775094903*^9, 3.594798879621613*^9, 3.59479899501974*^9, {
   3.594799348239743*^9, 3.594799370673485*^9}, 3.594799438041315*^9, {
   3.594799724639913*^9, 3.5947997432222157`*^9}, 3.594799802116107*^9, {
   3.594799870701089*^9, 3.594799905171001*^9}, 3.5947999710012608`*^9, {
   3.594800001149868*^9, 3.594800024780023*^9}, 3.5948000605406227`*^9, 
   3.594800191361587*^9, 3.594800437426289*^9, 3.594800502401843*^9, 
   3.594800793943123*^9, {3.59480084141462*^9, 3.594800860918365*^9}, 
   3.594800909961557*^9}],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{
   RowBox[{"{", "1", "}"}], ",", 
   RowBox[{"{", "1", "}"}], ",", 
   RowBox[{"{", "1", "}"}], ",", 
   RowBox[{"{", "1", "}"}]}], "}"}]], "Output",
 CellChangeTimes->{
  3.594730477613902*^9, {3.594730542191864*^9, 3.594730577848012*^9}, 
   3.594730714052774*^9, {3.594730760196371*^9, 3.594730795585177*^9}, 
   3.594730870885312*^9, {3.594731108266922*^9, 3.594731204047677*^9}, {
   3.594731270765168*^9, 3.594731289142494*^9}, 3.5947316347241173`*^9, 
   3.59473179907893*^9, 3.594731917739808*^9, 3.59473199742257*^9, 
   3.594732028069702*^9, 3.594732209888624*^9, {3.59473225968292*^9, 
   3.594732284871112*^9}, 3.5947329117844257`*^9, {3.594732950913261*^9, 
   3.594732969696723*^9}, {3.594733046872335*^9, 3.5947330618464127`*^9}, 
   3.594733094795782*^9, 3.594733181834568*^9, {3.594733344285214*^9, 
   3.594733356861854*^9}, {3.5947333895034933`*^9, 3.594733393121913*^9}, 
   3.594733515390991*^9, 3.594733706399859*^9, 3.594797441073186*^9, 
   3.594797529046836*^9, 3.594797644953837*^9, 3.594797707530582*^9, 
   3.594797750235661*^9, {3.594797825546906*^9, 3.5947978446616707`*^9}, {
   3.5947979839018307`*^9, 3.594798034034913*^9}, 3.594798107161086*^9, {
   3.5947981372429857`*^9, 3.5947981846963577`*^9}, {3.5947982309039297`*^9, 
   3.594798245173884*^9}, 3.5947983374800367`*^9, 3.594798395210162*^9, 
   3.594798775094903*^9, 3.594798879621613*^9, 3.59479899501974*^9, {
   3.594799348239743*^9, 3.594799370673485*^9}, 3.594799438041315*^9, {
   3.594799724639913*^9, 3.5947997432222157`*^9}, 3.594799802116107*^9, {
   3.594799870701089*^9, 3.594799905171001*^9}, 3.5947999710012608`*^9, {
   3.594800001149868*^9, 3.594800024780023*^9}, 3.5948000605406227`*^9, 
   3.594800191361587*^9, 3.594800437426289*^9, 3.594800502401843*^9, 
   3.594800793943123*^9, {3.59480084141462*^9, 3.594800860918365*^9}, 
   3.5948009099630632`*^9}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[{
 RowBox[{
  RowBox[{"f0", "=", 
   RowBox[{"0.5", 
    RowBox[{
     RowBox[{"Transpose", "[", "z", "]"}], ".", "H", ".", "z"}]}]}], 
  "\[IndentingNewLine]", 
  RowBox[{"(*", 
   RowBox[{
    RowBox[{"Minimize", "[", 
     RowBox[{
      RowBox[{"{", 
       RowBox[{"f0", ",", 
        RowBox[{
         RowBox[{"G", ".", "z"}], "<=", 
         RowBox[{"w", "+", 
          RowBox[{"S", " ", "xk0"}]}]}]}], "}"}], ",", " ", 
      RowBox[{"{", 
       RowBox[{"uk", ",", "uk1"}], "}"}]}], "]"}], "\[IndentingNewLine]", 
    RowBox[{"Minimize", "[", 
     RowBox[{
      RowBox[{"{", 
       RowBox[{
        RowBox[{"0.5", 
         RowBox[{
          RowBox[{"Transpose", "[", "z", "]"}], ".", "H", ".", "z"}]}], ",", 
        RowBox[{
         RowBox[{"G", ".", "z"}], "<=", 
         RowBox[{"w", "+", 
          RowBox[{"S", " ", "xk0"}]}]}]}], "}"}], ",", " ", 
      RowBox[{"{", 
       RowBox[{"uk", ",", " ", "uk1"}], "}"}]}], "]"}]}], 
   "*)"}]}], "\[IndentingNewLine]", 
 RowBox[{"Minimize", "[", 
  RowBox[{
   RowBox[{"{", 
    RowBox[{
     RowBox[{
      RowBox[{
       RowBox[{"(", 
        RowBox[{"Q", "+", "R"}], ")"}], " ", 
       SuperscriptBox["uk", "2"]}], "+", " ", 
      RowBox[{"R", " ", 
       SuperscriptBox["uk1", "2"]}]}], ",", 
     RowBox[{
      RowBox[{"uk", " ", "\[LessEqual]", "1"}], " ", "&&", " ", 
      RowBox[{"uk1", " ", "\[LessEqual]", " ", "1"}], "&&", " ", 
      RowBox[{"uk", " ", "\[GreaterEqual]", " ", 
       RowBox[{"-", "1"}]}], " ", "&&", " ", 
      RowBox[{"uk1", "\[GreaterEqual]", " ", 
       RowBox[{"-", "1"}]}]}]}], "}"}], ",", " ", 
   RowBox[{"{", 
    RowBox[{"uk", ",", "uk1"}], "}"}]}], "]"}]}], "Input",
 CellChangeTimes->{{3.594731639210679*^9, 3.594731703151429*^9}, {
   3.59473173928088*^9, 3.594731794604171*^9}, {3.594731914459764*^9, 
   3.594731915398007*^9}, {3.594731967009536*^9, 3.594731980696278*^9}, {
   3.5947320215081*^9, 3.594732023330594*^9}, {3.594732206596496*^9, 
   3.594732281354064*^9}, {3.594733050179756*^9, 3.5947330587908154`*^9}, {
   3.594733354277574*^9, 3.5947333732432327`*^9}, {3.594733696345573*^9, 
   3.594733700835821*^9}, {3.594797518688058*^9, 3.5947975230962954`*^9}, {
   3.594797589194202*^9, 3.594797636413249*^9}, 3.594797703660597*^9, {
   3.594797746389841*^9, 3.594797747271901*^9}, {3.5947978081941233`*^9, 
   3.594797838882764*^9}, 3.594797977969475*^9, 3.594798047430279*^9, {
   3.5947980842631083`*^9, 3.5947980993948298`*^9}, 3.594798133446835*^9, {
   3.594798222381872*^9, 3.5947982419397*^9}, {3.594798334474234*^9, 
   3.5947983409339647`*^9}, {3.594798761361702*^9, 3.5947987693300257`*^9}, 
   3.594798825918116*^9, {3.594798858798819*^9, 3.594798874486992*^9}, {
   3.594798961056306*^9, 3.594798983037919*^9}, {3.5947993187041903`*^9, 
   3.59479936710085*^9}, {3.5947994314863443`*^9, 3.5947994335876427`*^9}, {
   3.5947996979988127`*^9, 3.594799720843148*^9}, 3.5947997966132298`*^9, {
   3.5948000459614058`*^9, 3.594800054403399*^9}, {3.594800132266038*^9, 
   3.594800137895392*^9}}],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{"{", 
   RowBox[{"0.5`", " ", 
    RowBox[{"(", 
     RowBox[{
      RowBox[{"2", " ", "R", " ", 
       SuperscriptBox["uk1", "2"]}], "+", 
      RowBox[{"2", " ", 
       RowBox[{"(", 
        RowBox[{"Q", "+", "R"}], ")"}], " ", 
       SuperscriptBox[
        RowBox[{"(", 
         RowBox[{"uk", "+", 
          FractionBox[
           RowBox[{"Q", " ", "R", " ", "xk0"}], 
           RowBox[{
            RowBox[{"Q", " ", "R"}], "+", 
            SuperscriptBox["R", "2"]}]]}], ")"}], "2"]}]}], ")"}]}], "}"}], 
  "}"}]], "Output",
 CellChangeTimes->{
  3.594799370768155*^9, 3.5947994381396923`*^9, {3.594799724731492*^9, 
   3.594799743328018*^9}, 3.594799802210848*^9, {3.594799870788939*^9, 
   3.59479990525441*^9}, 3.594799971073048*^9, {3.5948000012344*^9, 
   3.594800024855022*^9}, 3.594800060560177*^9, 3.594800141591631*^9, 
   3.5948001913790827`*^9, 3.594800437522583*^9, 3.594800502499879*^9, 
   3.594800794035985*^9, {3.594800841508882*^9, 3.594800861025941*^9}, 
   3.5948009100626087`*^9}],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{
   TagBox[GridBox[{
      {"\[Piecewise]", GridBox[{
         {"0", 
          RowBox[{
           RowBox[{"(", 
            RowBox[{
             RowBox[{"R", "\[Equal]", "0"}], "&&", 
             RowBox[{"Q", "\[Equal]", "0"}]}], ")"}], "||", 
           RowBox[{"(", 
            RowBox[{
             RowBox[{"R", "\[Equal]", "0"}], "&&", 
             RowBox[{"Q", ">", "0"}]}], ")"}], "||", 
           RowBox[{"(", 
            RowBox[{
             RowBox[{"R", ">", "0"}], "&&", 
             RowBox[{"Q", ">", 
              RowBox[{"-", "R"}]}]}], ")"}]}]},
         {"Q", 
          RowBox[{
           RowBox[{"R", "\[Equal]", "0"}], "&&", 
           RowBox[{"Q", "<", "0"}]}]},
         {"R", 
          RowBox[{
           RowBox[{"R", "<", "0"}], "&&", 
           RowBox[{"Q", ">", 
            RowBox[{"-", "R"}]}]}]},
         {
          RowBox[{"Q", "+", "R"}], 
          RowBox[{
           RowBox[{"(", 
            RowBox[{
             RowBox[{"R", ">", "0"}], "&&", 
             RowBox[{"Q", "\[Equal]", 
              RowBox[{"-", "R"}]}]}], ")"}], "||", 
           RowBox[{"(", 
            RowBox[{
             RowBox[{"R", ">", "0"}], "&&", 
             RowBox[{"Q", "<", 
              RowBox[{"-", "R"}]}]}], ")"}]}]},
         {
          RowBox[{"Q", "+", 
           RowBox[{"2", " ", "R"}]}], 
          TagBox["True",
           "PiecewiseDefault",
           AutoDelete->True]}
        },
        AllowedDimensions->{2, Automatic},
        Editable->True,
        GridBoxAlignment->{
         "Columns" -> {{Left}}, "ColumnsIndexed" -> {}, 
          "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
        GridBoxItemSize->{
         "Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, "Rows" -> {{1.}},
           "RowsIndexed" -> {}},
        GridBoxSpacings->{"Columns" -> {
            Offset[0.27999999999999997`], {
             Offset[0.84]}, 
            Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, 
          "Rows" -> {
            Offset[0.2], {
             Offset[0.4]}, 
            Offset[0.2]}, "RowsIndexed" -> {}},
        Selectable->True]}
     },
     GridBoxAlignment->{
      "Columns" -> {{Left}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, 
       "RowsIndexed" -> {}},
     GridBoxItemSize->{
      "Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, "Rows" -> {{1.}}, 
       "RowsIndexed" -> {}},
     GridBoxSpacings->{"Columns" -> {
         Offset[0.27999999999999997`], {
          Offset[0.35]}, 
         Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
         Offset[0.2], {
          Offset[0.4]}, 
         Offset[0.2]}, "RowsIndexed" -> {}}],
    "Piecewise",
    DeleteWithContents->True,
    Editable->False,
    SelectWithContents->True,
    Selectable->False], ",", 
   RowBox[{"{", 
    RowBox[{
     RowBox[{"uk", "\[Rule]", 
      TagBox[GridBox[{
         {"\[Piecewise]", GridBox[{
            {
             RowBox[{"-", "1"}], 
             RowBox[{
              RowBox[{"(", 
               RowBox[{
                RowBox[{"R", "\[Equal]", "0"}], "&&", 
                RowBox[{"Q", "<", "0"}]}], ")"}], "||", 
              RowBox[{"(", 
               RowBox[{
                RowBox[{"R", ">", "0"}], "&&", 
                RowBox[{"Q", "<", 
                 RowBox[{"-", "R"}]}]}], ")"}], "||", 
              RowBox[{"(", 
               RowBox[{
                RowBox[{"R", "<", "0"}], "&&", 
                RowBox[{"Q", "<", 
                 RowBox[{"-", "R"}]}]}], ")"}]}]},
            {"0", 
             TagBox["True",
              "PiecewiseDefault",
              AutoDelete->True]}
           },
           AllowedDimensions->{2, Automatic},
           Editable->True,
           
           GridBoxAlignment->{
            "Columns" -> {{Left}}, "ColumnsIndexed" -> {}, 
             "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
           
           GridBoxItemSize->{
            "Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, 
             "Rows" -> {{1.}}, "RowsIndexed" -> {}},
           GridBoxSpacings->{"Columns" -> {
               Offset[0.27999999999999997`], {
                Offset[0.84]}, 
               Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
               Offset[0.2], {
                Offset[0.4]}, 
               Offset[0.2]}, "RowsIndexed" -> {}},
           Selectable->True]}
        },
        GridBoxAlignment->{
         "Columns" -> {{Left}}, "ColumnsIndexed" -> {}, 
          "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
        GridBoxItemSize->{
         "Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, "Rows" -> {{1.}},
           "RowsIndexed" -> {}},
        GridBoxSpacings->{"Columns" -> {
            Offset[0.27999999999999997`], {
             Offset[0.35]}, 
            Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, 
          "Rows" -> {
            Offset[0.2], {
             Offset[0.4]}, 
            Offset[0.2]}, "RowsIndexed" -> {}}],
       "Piecewise",
       DeleteWithContents->True,
       Editable->False,
       SelectWithContents->True,
       Selectable->False]}], ",", 
     RowBox[{"uk1", "\[Rule]", 
      TagBox[GridBox[{
         {"\[Piecewise]", GridBox[{
            {
             RowBox[{"-", "1"}], 
             RowBox[{
              RowBox[{"(", 
               RowBox[{
                RowBox[{"R", "<", "0"}], "&&", 
                RowBox[{"Q", "\[Equal]", 
                 RowBox[{"-", "R"}]}]}], ")"}], "||", 
              RowBox[{"(", 
               RowBox[{
                RowBox[{"R", "<", "0"}], "&&", 
                RowBox[{"Q", ">", 
                 RowBox[{"-", "R"}]}]}], ")"}], "||", 
              RowBox[{"(", 
               RowBox[{
                RowBox[{"R", "<", "0"}], "&&", 
                RowBox[{"Q", "<", 
                 RowBox[{"-", "R"}]}]}], ")"}]}]},
            {"0", 
             RowBox[{
              RowBox[{"(", 
               RowBox[{
                RowBox[{"R", "\[Equal]", "0"}], "&&", 
                RowBox[{"Q", "\[Equal]", "0"}]}], ")"}], "||", 
              RowBox[{"(", 
               RowBox[{
                RowBox[{"R", "\[Equal]", "0"}], "&&", 
                RowBox[{"Q", ">", "0"}]}], ")"}], "||", 
              RowBox[{"(", 
               RowBox[{
                RowBox[{"R", "\[Equal]", "0"}], "&&", 
                RowBox[{"Q", "<", "0"}]}], ")"}], "||", 
              RowBox[{"(", 
               RowBox[{
                RowBox[{"R", ">", "0"}], "&&", 
                RowBox[{"Q", ">", 
                 RowBox[{"-", "R"}]}]}], ")"}], "||", 
              RowBox[{"(", 
               RowBox[{
                RowBox[{"R", ">", "0"}], "&&", 
                RowBox[{"Q", "<", 
                 RowBox[{"-", "R"}]}]}], ")"}]}]},
            {
             RowBox[{"-", 
              SqrtBox[
               FractionBox[
                RowBox[{"Q", "+", "R"}], "R"]]}], 
             TagBox["True",
              "PiecewiseDefault",
              AutoDelete->True]}
           },
           AllowedDimensions->{2, Automatic},
           Editable->True,
           
           GridBoxAlignment->{
            "Columns" -> {{Left}}, "ColumnsIndexed" -> {}, 
             "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
           
           GridBoxItemSize->{
            "Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, 
             "Rows" -> {{1.}}, "RowsIndexed" -> {}},
           GridBoxSpacings->{"Columns" -> {
               Offset[0.27999999999999997`], {
                Offset[0.84]}, 
               Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
               Offset[0.2], {
                Offset[0.4]}, 
               Offset[0.2]}, "RowsIndexed" -> {}},
           Selectable->True]}
        },
        GridBoxAlignment->{
         "Columns" -> {{Left}}, "ColumnsIndexed" -> {}, 
          "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
        GridBoxItemSize->{
         "Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, "Rows" -> {{1.}},
           "RowsIndexed" -> {}},
        GridBoxSpacings->{"Columns" -> {
            Offset[0.27999999999999997`], {
             Offset[0.35]}, 
            Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, 
          "Rows" -> {
            Offset[0.2], {
             Offset[0.4]}, 
            Offset[0.2]}, "RowsIndexed" -> {}}],
       "Piecewise",
       DeleteWithContents->True,
       Editable->False,
       SelectWithContents->True,
       Selectable->False]}]}], "}"}]}], "}"}]], "Output",
 CellChangeTimes->{
  3.594799370768155*^9, 3.5947994381396923`*^9, {3.594799724731492*^9, 
   3.594799743328018*^9}, 3.594799802210848*^9, {3.594799870788939*^9, 
   3.59479990525441*^9}, 3.594799971073048*^9, {3.5948000012344*^9, 
   3.594800024855022*^9}, 3.594800060560177*^9, 3.594800141591631*^9, 
   3.5948001913790827`*^9, 3.594800437522583*^9, 3.594800502499879*^9, 
   3.594800794035985*^9, {3.594800841508882*^9, 3.594800861025941*^9}, 
   3.5948009101249027`*^9}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Minimize", "[", 
  RowBox[{
   RowBox[{"{", 
    RowBox[{
     RowBox[{
      RowBox[{"R", " ", 
       RowBox[{"uk1", "^", "2"}]}], "+", " ", 
      RowBox[{
       RowBox[{"(", 
        RowBox[{"Q", "+", "R"}], ")"}], 
       RowBox[{
        RowBox[{"(", 
         RowBox[{"uk", "+", 
          RowBox[{
           RowBox[{"(", 
            RowBox[{"Q", "  ", "xk0"}], ")"}], "/", 
           RowBox[{"(", 
            RowBox[{"Q", " ", "+", " ", "R"}], ")"}]}]}], ")"}], "^", 
        "2"}]}]}], ",", 
     RowBox[{
      RowBox[{"uk", " ", "\[LessEqual]", "1"}], " ", "&&", " ", 
      RowBox[{"uk1", " ", "\[LessEqual]", " ", "1"}], "&&", " ", 
      RowBox[{"uk", " ", "\[GreaterEqual]", " ", 
       RowBox[{"-", "1"}]}], " ", "&&", " ", 
      RowBox[{"uk1", "\[GreaterEqual]", " ", 
       RowBox[{"-", "1"}]}], " ", "&&", " ", 
      RowBox[{"Q", " ", ">", " ", "0"}], " ", "&&", " ", 
      RowBox[{"R", ">", " ", "0"}]}]}], "}"}], ",", " ", 
   RowBox[{"{", 
    RowBox[{"uk", ",", "uk1"}], "}"}]}], "]"}]], "Input",
 CellChangeTimes->{
  3.594799703992758*^9, {3.594800175717691*^9, 3.5948001838076353`*^9}, {
   3.594800333784276*^9, 3.5948004323203983`*^9}, {3.594800488525416*^9, 
   3.5948004922047987`*^9}, {3.5948007591000967`*^9, 3.594800789205844*^9}, {
   3.594800846108787*^9, 3.594800855511003*^9}}],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{
   TagBox[GridBox[{
      {"\[Piecewise]", GridBox[{
         {"0", 
          RowBox[{
           RowBox[{"(", 
            RowBox[{
             RowBox[{"R", ">", "0"}], "&&", 
             RowBox[{"Q", "\[GreaterEqual]", 
              RowBox[{
               RowBox[{"-", 
                FractionBox["R", "4"]}], "+", 
               FractionBox[
                SqrtBox[
                 SuperscriptBox["R", "2"]], 
                SqrtBox["2"]]}]}], "&&", 
             RowBox[{"xk0", "\[Equal]", 
              FractionBox[
               RowBox[{
                RowBox[{"-", "Q"}], "-", "R"}], "Q"]}]}], ")"}], "||", 
           RowBox[{"(", 
            RowBox[{
             RowBox[{"R", ">", "0"}], "&&", 
             RowBox[{"Q", "\[GreaterEqual]", 
              RowBox[{
               RowBox[{"-", 
                FractionBox["R", "4"]}], "+", 
               FractionBox[
                SqrtBox[
                 SuperscriptBox["R", "2"]], 
                SqrtBox["2"]]}]}], "&&", 
             RowBox[{"xk0", "\[Equal]", 
              FractionBox[
               RowBox[{"Q", "+", "R"}], "Q"]}]}], ")"}], "||", 
           RowBox[{"(", 
            RowBox[{
             RowBox[{"R", ">", "0"}], "&&", 
             RowBox[{"Q", "\[GreaterEqual]", 
              RowBox[{
               RowBox[{"-", 
                FractionBox["R", "4"]}], "+", 
               FractionBox[
                SqrtBox[
                 SuperscriptBox["R", "2"]], 
                SqrtBox["2"]]}]}], "&&", 
             RowBox[{
              FractionBox[
               RowBox[{
                RowBox[{"-", "Q"}], "-", "R"}], "Q"], "<", "xk0", "<", 
              FractionBox[
               RowBox[{"Q", "+", "R"}], "Q"]}]}], ")"}], "||", 
           RowBox[{"(", 
            RowBox[{
             RowBox[{"R", ">", "0"}], "&&", 
             RowBox[{"0", "<", "Q", "<", 
              RowBox[{
               RowBox[{"-", 
                FractionBox["R", "4"]}], "+", 
               FractionBox[
                SqrtBox[
                 SuperscriptBox["R", "2"]], 
                SqrtBox["2"]]}]}], "&&", 
             RowBox[{
              FractionBox[
               RowBox[{
                RowBox[{"-", "Q"}], "-", "R"}], "Q"], "<", "xk0", 
              "\[LessEqual]", 
              FractionBox[
               RowBox[{"Q", "+", "R"}], "Q"]}]}], ")"}]}]},
         {
          FractionBox[
           RowBox[{
            SuperscriptBox["Q", "2"], "+", 
            RowBox[{"2", " ", "Q", " ", "R"}], "+", 
            SuperscriptBox["R", "2"], "-", 
            RowBox[{"2", " ", 
             SuperscriptBox["Q", "2"], " ", "xk0"}], "-", 
            RowBox[{"2", " ", "Q", " ", "R", " ", "xk0"}], "+", 
            RowBox[{
             SuperscriptBox["Q", "2"], " ", 
             SuperscriptBox["xk0", "2"]}]}], 
           RowBox[{"Q", "+", "R"}]], 
          RowBox[{
           RowBox[{"(", 
            RowBox[{
             RowBox[{"R", ">", "0"}], "&&", 
             RowBox[{"Q", "\[GreaterEqual]", 
              RowBox[{
               RowBox[{"-", 
                FractionBox["R", "4"]}], "+", 
               FractionBox[
                SqrtBox[
                 SuperscriptBox["R", "2"]], 
                SqrtBox["2"]]}]}], "&&", 
             RowBox[{"xk0", ">", 
              FractionBox[
               RowBox[{"Q", "+", "R"}], "Q"]}]}], ")"}], "||", 
           RowBox[{"(", 
            RowBox[{
             RowBox[{"R", ">", "0"}], "&&", 
             RowBox[{"0", "<", "Q", "<", 
              RowBox[{
               RowBox[{"-", 
                FractionBox["R", "4"]}], "+", 
               FractionBox[
                SqrtBox[
                 SuperscriptBox["R", "2"]], 
                SqrtBox["2"]]}]}], "&&", 
             RowBox[{"xk0", ">", 
              FractionBox[
               RowBox[{"Q", "+", "R"}], "Q"]}]}], ")"}]}]},
         {
          FractionBox[
           RowBox[{
            SuperscriptBox["Q", "2"], "+", 
            RowBox[{"2", " ", "Q", " ", "R"}], "+", 
            SuperscriptBox["R", "2"], "+", 
            RowBox[{"2", " ", 
             SuperscriptBox["Q", "2"], " ", "xk0"}], "+", 
            RowBox[{"2", " ", "Q", " ", "R", " ", "xk0"}], "+", 
            RowBox[{
             SuperscriptBox["Q", "2"], " ", 
             SuperscriptBox["xk0", "2"]}]}], 
           RowBox[{"Q", "+", "R"}]], 
          RowBox[{
           RowBox[{"(", 
            RowBox[{
             RowBox[{"R", ">", "0"}], "&&", 
             RowBox[{"Q", "\[GreaterEqual]", 
              RowBox[{
               RowBox[{"-", 
                FractionBox["R", "4"]}], "+", 
               FractionBox[
                SqrtBox[
                 SuperscriptBox["R", "2"]], 
                SqrtBox["2"]]}]}], "&&", 
             RowBox[{"xk0", "<", 
              FractionBox[
               RowBox[{
                RowBox[{"-", "Q"}], "-", "R"}], "Q"]}]}], ")"}], "||", 
           RowBox[{"(", 
            RowBox[{
             RowBox[{"R", ">", "0"}], "&&", 
             RowBox[{"0", "<", "Q", "<", 
              RowBox[{
               RowBox[{"-", 
                FractionBox["R", "4"]}], "+", 
               FractionBox[
                SqrtBox[
                 SuperscriptBox["R", "2"]], 
                SqrtBox["2"]]}]}], "&&", 
             RowBox[{"xk0", "\[LessEqual]", 
              FractionBox[
               RowBox[{
                RowBox[{"-", "Q"}], "-", "R"}], "Q"]}]}], ")"}]}]},
         {"\[Infinity]", 
          TagBox["True",
           "PiecewiseDefault",
           AutoDelete->True]}
        },
        AllowedDimensions->{2, Automatic},
        Editable->True,
        GridBoxAlignment->{
         "Columns" -> {{Left}}, "ColumnsIndexed" -> {}, 
          "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
        GridBoxItemSize->{
         "Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, "Rows" -> {{1.}},
           "RowsIndexed" -> {}},
        GridBoxSpacings->{"Columns" -> {
            Offset[0.27999999999999997`], {
             Offset[0.84]}, 
            Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, 
          "Rows" -> {
            Offset[0.2], {
             Offset[0.4]}, 
            Offset[0.2]}, "RowsIndexed" -> {}},
        Selectable->True]}
     },
     GridBoxAlignment->{
      "Columns" -> {{Left}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, 
       "RowsIndexed" -> {}},
     GridBoxItemSize->{
      "Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, "Rows" -> {{1.}}, 
       "RowsIndexed" -> {}},
     GridBoxSpacings->{"Columns" -> {
         Offset[0.27999999999999997`], {
          Offset[0.35]}, 
         Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
         Offset[0.2], {
          Offset[0.4]}, 
         Offset[0.2]}, "RowsIndexed" -> {}}],
    "Piecewise",
    DeleteWithContents->True,
    Editable->False,
    SelectWithContents->True,
    Selectable->False], ",", 
   RowBox[{"{", 
    RowBox[{
     RowBox[{"uk", "\[Rule]", 
      TagBox[GridBox[{
         {"\[Piecewise]", GridBox[{
            {
             RowBox[{"-", "1"}], 
             RowBox[{
              RowBox[{"(", 
               RowBox[{
                RowBox[{"R", ">", "0"}], "&&", 
                RowBox[{"Q", "\[GreaterEqual]", 
                 RowBox[{
                  RowBox[{"-", 
                   FractionBox["R", "4"]}], "+", 
                  FractionBox[
                   SqrtBox[
                    SuperscriptBox["R", "2"]], 
                   SqrtBox["2"]]}]}], "&&", 
                RowBox[{"xk0", "\[Equal]", 
                 FractionBox[
                  RowBox[{"Q", "+", "R"}], "Q"]}]}], ")"}], "||", 
              RowBox[{"(", 
               RowBox[{
                RowBox[{"R", ">", "0"}], "&&", 
                RowBox[{"Q", "\[GreaterEqual]", 
                 RowBox[{
                  RowBox[{"-", 
                   FractionBox["R", "4"]}], "+", 
                  FractionBox[
                   SqrtBox[
                    SuperscriptBox["R", "2"]], 
                   SqrtBox["2"]]}]}], "&&", 
                RowBox[{"xk0", ">", 
                 FractionBox[
                  RowBox[{"Q", "+", "R"}], "Q"]}]}], ")"}], "||", 
              RowBox[{"(", 
               RowBox[{
                RowBox[{"R", ">", "0"}], "&&", 
                RowBox[{"0", "<", "Q", "<", 
                 RowBox[{
                  RowBox[{"-", 
                   FractionBox["R", "4"]}], "+", 
                  FractionBox[
                   SqrtBox[
                    SuperscriptBox["R", "2"]], 
                   SqrtBox["2"]]}]}], "&&", 
                RowBox[{"xk0", ">", 
                 FractionBox[
                  RowBox[{"Q", "+", "R"}], "Q"]}]}], ")"}]}]},
            {"1", 
             RowBox[{
              RowBox[{"(", 
               RowBox[{
                RowBox[{"R", ">", "0"}], "&&", 
                RowBox[{"Q", "\[GreaterEqual]", 
                 RowBox[{
                  RowBox[{"-", 
                   FractionBox["R", "4"]}], "+", 
                  FractionBox[
                   SqrtBox[
                    SuperscriptBox["R", "2"]], 
                   SqrtBox["2"]]}]}], "&&", 
                RowBox[{"xk0", "\[Equal]", 
                 FractionBox[
                  RowBox[{
                   RowBox[{"-", "Q"}], "-", "R"}], "Q"]}]}], ")"}], "||", 
              RowBox[{"(", 
               RowBox[{
                RowBox[{"R", ">", "0"}], "&&", 
                RowBox[{"Q", "\[GreaterEqual]", 
                 RowBox[{
                  RowBox[{"-", 
                   FractionBox["R", "4"]}], "+", 
                  FractionBox[
                   SqrtBox[
                    SuperscriptBox["R", "2"]], 
                   SqrtBox["2"]]}]}], "&&", 
                RowBox[{"xk0", "<", 
                 FractionBox[
                  RowBox[{
                   RowBox[{"-", "Q"}], "-", "R"}], "Q"]}]}], ")"}], "||", 
              RowBox[{"(", 
               RowBox[{
                RowBox[{"R", ">", "0"}], "&&", 
                RowBox[{"0", "<", "Q", "<", 
                 RowBox[{
                  RowBox[{"-", 
                   FractionBox["R", "4"]}], "+", 
                  FractionBox[
                   SqrtBox[
                    SuperscriptBox["R", "2"]], 
                   SqrtBox["2"]]}]}], "&&", 
                RowBox[{"xk0", "\[LessEqual]", 
                 FractionBox[
                  RowBox[{
                   RowBox[{"-", "Q"}], "-", "R"}], "Q"]}]}], ")"}]}]},
            {
             RowBox[{"-", 
              FractionBox[
               RowBox[{"Q", " ", "xk0"}], 
               RowBox[{"Q", "+", "R"}]]}], 
             RowBox[{
              RowBox[{"(", 
               RowBox[{
                RowBox[{"R", ">", "0"}], "&&", 
                RowBox[{"Q", "\[GreaterEqual]", 
                 RowBox[{
                  RowBox[{"-", 
                   FractionBox["R", "4"]}], "+", 
                  FractionBox[
                   SqrtBox[
                    SuperscriptBox["R", "2"]], 
                   SqrtBox["2"]]}]}], "&&", 
                RowBox[{
                 FractionBox[
                  RowBox[{
                   RowBox[{"-", "Q"}], "-", "R"}], "Q"], "<", "xk0", "<", 
                 FractionBox[
                  RowBox[{"Q", "+", "R"}], "Q"]}]}], ")"}], "||", 
              RowBox[{"(", 
               RowBox[{
                RowBox[{"R", ">", "0"}], "&&", 
                RowBox[{"0", "<", "Q", "<", 
                 RowBox[{
                  RowBox[{"-", 
                   FractionBox["R", "4"]}], "+", 
                  FractionBox[
                   SqrtBox[
                    SuperscriptBox["R", "2"]], 
                   SqrtBox["2"]]}]}], "&&", 
                RowBox[{
                 FractionBox[
                  RowBox[{
                   RowBox[{"-", "Q"}], "-", "R"}], "Q"], "<", "xk0", 
                 "\[LessEqual]", 
                 FractionBox[
                  RowBox[{"Q", "+", "R"}], "Q"]}]}], ")"}]}]},
            {"Indeterminate", 
             TagBox["True",
              "PiecewiseDefault",
              AutoDelete->True]}
           },
           AllowedDimensions->{2, Automatic},
           Editable->True,
           
           GridBoxAlignment->{
            "Columns" -> {{Left}}, "ColumnsIndexed" -> {}, 
             "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
           
           GridBoxItemSize->{
            "Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, 
             "Rows" -> {{1.}}, "RowsIndexed" -> {}},
           GridBoxSpacings->{"Columns" -> {
               Offset[0.27999999999999997`], {
                Offset[0.84]}, 
               Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
               Offset[0.2], {
                Offset[0.4]}, 
               Offset[0.2]}, "RowsIndexed" -> {}},
           Selectable->True]}
        },
        GridBoxAlignment->{
         "Columns" -> {{Left}}, "ColumnsIndexed" -> {}, 
          "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
        GridBoxItemSize->{
         "Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, "Rows" -> {{1.}},
           "RowsIndexed" -> {}},
        GridBoxSpacings->{"Columns" -> {
            Offset[0.27999999999999997`], {
             Offset[0.35]}, 
            Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, 
          "Rows" -> {
            Offset[0.2], {
             Offset[0.4]}, 
            Offset[0.2]}, "RowsIndexed" -> {}}],
       "Piecewise",
       DeleteWithContents->True,
       Editable->False,
       SelectWithContents->True,
       Selectable->False]}], ",", 
     RowBox[{"uk1", "\[Rule]", 
      TagBox[GridBox[{
         {"\[Piecewise]", GridBox[{
            {
             RowBox[{"-", 
              SqrtBox[
               FractionBox[
                RowBox[{
                 RowBox[{"-", 
                  SuperscriptBox["Q", "2"]}], "-", 
                 RowBox[{"2", " ", "Q", " ", "R"}], "-", 
                 SuperscriptBox["R", "2"], "-", 
                 RowBox[{"2", " ", 
                  SuperscriptBox["Q", "2"], " ", "xk0"}], "-", 
                 RowBox[{"2", " ", "Q", " ", "R", " ", "xk0"}], "-", 
                 RowBox[{
                  SuperscriptBox["Q", "2"], " ", 
                  SuperscriptBox["xk0", "2"]}]}], 
                RowBox[{"R", " ", 
                 RowBox[{"(", 
                  RowBox[{"Q", "+", "R"}], ")"}]}]]]}], 
             RowBox[{
              RowBox[{"R", ">", "0"}], "&&", 
              RowBox[{"Q", "\[GreaterEqual]", 
               RowBox[{
                RowBox[{"-", 
                 FractionBox["R", "4"]}], "+", 
                FractionBox[
                 SqrtBox[
                  SuperscriptBox["R", "2"]], 
                 SqrtBox["2"]]}]}], "&&", 
              RowBox[{"xk0", "\[Equal]", 
               FractionBox[
                RowBox[{
                 RowBox[{"-", "Q"}], "-", "R"}], "Q"]}]}]},
            {
             RowBox[{"-", 
              SqrtBox[
               FractionBox[
                RowBox[{
                 RowBox[{"-", 
                  SuperscriptBox["Q", "2"]}], "-", 
                 RowBox[{"2", " ", "Q", " ", "R"}], "-", 
                 SuperscriptBox["R", "2"], "+", 
                 RowBox[{"2", " ", 
                  SuperscriptBox["Q", "2"], " ", "xk0"}], "+", 
                 RowBox[{"2", " ", "Q", " ", "R", " ", "xk0"}], "-", 
                 RowBox[{
                  SuperscriptBox["Q", "2"], " ", 
                  SuperscriptBox["xk0", "2"]}]}], 
                RowBox[{"R", " ", 
                 RowBox[{"(", 
                  RowBox[{"Q", "+", "R"}], ")"}]}]]]}], 
             RowBox[{
              RowBox[{"R", ">", "0"}], "&&", 
              RowBox[{"Q", "\[GreaterEqual]", 
               RowBox[{
                RowBox[{"-", 
                 FractionBox["R", "4"]}], "+", 
                FractionBox[
                 SqrtBox[
                  SuperscriptBox["R", "2"]], 
                 SqrtBox["2"]]}]}], "&&", 
              RowBox[{"xk0", "\[Equal]", 
               FractionBox[
                RowBox[{"Q", "+", "R"}], "Q"]}]}]},
            {
             RowBox[{"-", 
              SqrtBox[
               FractionBox[
                RowBox[{
                 RowBox[{
                  RowBox[{"-", 
                   SuperscriptBox["Q", "2"]}], " ", 
                  SuperscriptBox["xk0", "2"]}], "-", 
                 FractionBox[
                  RowBox[{
                   SuperscriptBox["Q", "4"], " ", 
                   SuperscriptBox["xk0", "2"]}], 
                  SuperscriptBox[
                   RowBox[{"(", 
                    RowBox[{"Q", "+", "R"}], ")"}], "2"]], "-", 
                 FractionBox[
                  RowBox[{"2", " ", 
                   SuperscriptBox["Q", "3"], " ", "R", " ", 
                   SuperscriptBox["xk0", "2"]}], 
                  SuperscriptBox[
                   RowBox[{"(", 
                    RowBox[{"Q", "+", "R"}], ")"}], "2"]], "-", 
                 FractionBox[
                  RowBox[{
                   SuperscriptBox["Q", "2"], " ", 
                   SuperscriptBox["R", "2"], " ", 
                   SuperscriptBox["xk0", "2"]}], 
                  SuperscriptBox[
                   RowBox[{"(", 
                    RowBox[{"Q", "+", "R"}], ")"}], "2"]], "+", 
                 FractionBox[
                  RowBox[{"2", " ", 
                   SuperscriptBox["Q", "3"], " ", 
                   SuperscriptBox["xk0", "2"]}], 
                  RowBox[{"Q", "+", "R"}]], "+", 
                 FractionBox[
                  RowBox[{"2", " ", 
                   SuperscriptBox["Q", "2"], " ", "R", " ", 
                   SuperscriptBox["xk0", "2"]}], 
                  RowBox[{"Q", "+", "R"}]]}], 
                RowBox[{"R", " ", 
                 RowBox[{"(", 
                  RowBox[{"Q", "+", "R"}], ")"}]}]]]}], 
             RowBox[{
              RowBox[{"(", 
               RowBox[{
                RowBox[{"R", ">", "0"}], "&&", 
                RowBox[{"Q", "\[GreaterEqual]", 
                 RowBox[{
                  RowBox[{"-", 
                   FractionBox["R", "4"]}], "+", 
                  FractionBox[
                   SqrtBox[
                    SuperscriptBox["R", "2"]], 
                   SqrtBox["2"]]}]}], "&&", 
                RowBox[{
                 FractionBox[
                  RowBox[{
                   RowBox[{"-", "Q"}], "-", "R"}], "Q"], "<", "xk0", "<", 
                 FractionBox[
                  RowBox[{"Q", "+", "R"}], "Q"]}]}], ")"}], "||", 
              RowBox[{"(", 
               RowBox[{
                RowBox[{"R", ">", "0"}], "&&", 
                RowBox[{"0", "<", "Q", "<", 
                 RowBox[{
                  RowBox[{"-", 
                   FractionBox["R", "4"]}], "+", 
                  FractionBox[
                   SqrtBox[
                    SuperscriptBox["R", "2"]], 
                   SqrtBox["2"]]}]}], "&&", 
                RowBox[{
                 FractionBox[
                  RowBox[{
                   RowBox[{"-", "Q"}], "-", "R"}], "Q"], "<", "xk0", 
                 "\[LessEqual]", 
                 FractionBox[
                  RowBox[{"Q", "+", "R"}], "Q"]}]}], ")"}]}]},
            {
             RowBox[{"-", 
              RowBox[{"\[Sqrt]", 
               RowBox[{"(", 
                RowBox[{
                 RowBox[{"1", "/", 
                  RowBox[{"(", 
                   RowBox[{"R", " ", 
                    RowBox[{"(", 
                    RowBox[{"Q", "+", "R"}], ")"}]}], ")"}]}], 
                 RowBox[{"(", 
                  RowBox[{
                   RowBox[{"-", 
                    SuperscriptBox["Q", "2"]}], "-", 
                   RowBox[{"2", " ", "Q", " ", "R"}], "-", 
                   SuperscriptBox["R", "2"], "+", 
                   RowBox[{"2", " ", 
                    SuperscriptBox["Q", "2"], " ", "xk0"}], "+", 
                   RowBox[{"2", " ", "Q", " ", "R", " ", "xk0"}], "-", 
                   RowBox[{
                    SuperscriptBox["Q", "2"], " ", 
                    SuperscriptBox["xk0", "2"]}], "+", 
                   FractionBox[
                    RowBox[{"Q", " ", 
                    RowBox[{"(", 
                    RowBox[{
                    SuperscriptBox["Q", "2"], "+", 
                    RowBox[{"2", " ", "Q", " ", "R"}], "+", 
                    SuperscriptBox["R", "2"], "-", 
                    RowBox[{"2", " ", 
                    SuperscriptBox["Q", "2"], " ", "xk0"}], "-", 
                    RowBox[{"2", " ", "Q", " ", "R", " ", "xk0"}], "+", 
                    RowBox[{
                    SuperscriptBox["Q", "2"], " ", 
                    SuperscriptBox["xk0", "2"]}]}], ")"}]}], 
                    RowBox[{"Q", "+", "R"}]], "+", 
                   FractionBox[
                    RowBox[{"R", " ", 
                    RowBox[{"(", 
                    RowBox[{
                    SuperscriptBox["Q", "2"], "+", 
                    RowBox[{"2", " ", "Q", " ", "R"}], "+", 
                    SuperscriptBox["R", "2"], "-", 
                    RowBox[{"2", " ", 
                    SuperscriptBox["Q", "2"], " ", "xk0"}], "-", 
                    RowBox[{"2", " ", "Q", " ", "R", " ", "xk0"}], "+", 
                    RowBox[{
                    SuperscriptBox["Q", "2"], " ", 
                    SuperscriptBox["xk0", "2"]}]}], ")"}]}], 
                    RowBox[{"Q", "+", "R"}]]}], ")"}]}], ")"}]}]}], 
             RowBox[{
              RowBox[{"(", 
               RowBox[{
                RowBox[{"R", ">", "0"}], "&&", 
                RowBox[{"Q", "\[GreaterEqual]", 
                 RowBox[{
                  RowBox[{"-", 
                   FractionBox["R", "4"]}], "+", 
                  FractionBox[
                   SqrtBox[
                    SuperscriptBox["R", "2"]], 
                   SqrtBox["2"]]}]}], "&&", 
                RowBox[{"xk0", ">", 
                 FractionBox[
                  RowBox[{"Q", "+", "R"}], "Q"]}]}], ")"}], "||", 
              RowBox[{"(", 
               RowBox[{
                RowBox[{"R", ">", "0"}], "&&", 
                RowBox[{"0", "<", "Q", "<", 
                 RowBox[{
                  RowBox[{"-", 
                   FractionBox["R", "4"]}], "+", 
                  FractionBox[
                   SqrtBox[
                    SuperscriptBox["R", "2"]], 
                   SqrtBox["2"]]}]}], "&&", 
                RowBox[{"xk0", ">", 
                 FractionBox[
                  RowBox[{"Q", "+", "R"}], "Q"]}]}], ")"}]}]},
            {
             RowBox[{"-", 
              RowBox[{"\[Sqrt]", 
               RowBox[{"(", 
                RowBox[{
                 RowBox[{"1", "/", 
                  RowBox[{"(", 
                   RowBox[{"R", " ", 
                    RowBox[{"(", 
                    RowBox[{"Q", "+", "R"}], ")"}]}], ")"}]}], 
                 RowBox[{"(", 
                  RowBox[{
                   RowBox[{"-", 
                    SuperscriptBox["Q", "2"]}], "-", 
                   RowBox[{"2", " ", "Q", " ", "R"}], "-", 
                   SuperscriptBox["R", "2"], "-", 
                   RowBox[{"2", " ", 
                    SuperscriptBox["Q", "2"], " ", "xk0"}], "-", 
                   RowBox[{"2", " ", "Q", " ", "R", " ", "xk0"}], "-", 
                   RowBox[{
                    SuperscriptBox["Q", "2"], " ", 
                    SuperscriptBox["xk0", "2"]}], "+", 
                   FractionBox[
                    RowBox[{"Q", " ", 
                    RowBox[{"(", 
                    RowBox[{
                    SuperscriptBox["Q", "2"], "+", 
                    RowBox[{"2", " ", "Q", " ", "R"}], "+", 
                    SuperscriptBox["R", "2"], "+", 
                    RowBox[{"2", " ", 
                    SuperscriptBox["Q", "2"], " ", "xk0"}], "+", 
                    RowBox[{"2", " ", "Q", " ", "R", " ", "xk0"}], "+", 
                    RowBox[{
                    SuperscriptBox["Q", "2"], " ", 
                    SuperscriptBox["xk0", "2"]}]}], ")"}]}], 
                    RowBox[{"Q", "+", "R"}]], "+", 
                   FractionBox[
                    RowBox[{"R", " ", 
                    RowBox[{"(", 
                    RowBox[{
                    SuperscriptBox["Q", "2"], "+", 
                    RowBox[{"2", " ", "Q", " ", "R"}], "+", 
                    SuperscriptBox["R", "2"], "+", 
                    RowBox[{"2", " ", 
                    SuperscriptBox["Q", "2"], " ", "xk0"}], "+", 
                    RowBox[{"2", " ", "Q", " ", "R", " ", "xk0"}], "+", 
                    RowBox[{
                    SuperscriptBox["Q", "2"], " ", 
                    SuperscriptBox["xk0", "2"]}]}], ")"}]}], 
                    RowBox[{"Q", "+", "R"}]]}], ")"}]}], ")"}]}]}], 
             RowBox[{
              RowBox[{"(", 
               RowBox[{
                RowBox[{"R", ">", "0"}], "&&", 
                RowBox[{"Q", "\[GreaterEqual]", 
                 RowBox[{
                  RowBox[{"-", 
                   FractionBox["R", "4"]}], "+", 
                  FractionBox[
                   SqrtBox[
                    SuperscriptBox["R", "2"]], 
                   SqrtBox["2"]]}]}], "&&", 
                RowBox[{"xk0", "<", 
                 FractionBox[
                  RowBox[{
                   RowBox[{"-", "Q"}], "-", "R"}], "Q"]}]}], ")"}], "||", 
              RowBox[{"(", 
               RowBox[{
                RowBox[{"R", ">", "0"}], "&&", 
                RowBox[{"0", "<", "Q", "<", 
                 RowBox[{
                  RowBox[{"-", 
                   FractionBox["R", "4"]}], "+", 
                  FractionBox[
                   SqrtBox[
                    SuperscriptBox["R", "2"]], 
                   SqrtBox["2"]]}]}], "&&", 
                RowBox[{"xk0", "\[LessEqual]", 
                 FractionBox[
                  RowBox[{
                   RowBox[{"-", "Q"}], "-", "R"}], "Q"]}]}], ")"}]}]},
            {"Indeterminate", 
             TagBox["True",
              "PiecewiseDefault",
              AutoDelete->True]}
           },
           AllowedDimensions->{2, Automatic},
           Editable->True,
           
           GridBoxAlignment->{
            "Columns" -> {{Left}}, "ColumnsIndexed" -> {}, 
             "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
           
           GridBoxItemSize->{
            "Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, 
             "Rows" -> {{1.}}, "RowsIndexed" -> {}},
           GridBoxSpacings->{"Columns" -> {
               Offset[0.27999999999999997`], {
                Offset[0.84]}, 
               Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
               Offset[0.2], {
                Offset[0.4]}, 
               Offset[0.2]}, "RowsIndexed" -> {}},
           Selectable->True]}
        },
        GridBoxAlignment->{
         "Columns" -> {{Left}}, "ColumnsIndexed" -> {}, 
          "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
        GridBoxItemSize->{
         "Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, "Rows" -> {{1.}},
           "RowsIndexed" -> {}},
        GridBoxSpacings->{"Columns" -> {
            Offset[0.27999999999999997`], {
             Offset[0.35]}, 
            Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, 
          "Rows" -> {
            Offset[0.2], {
             Offset[0.4]}, 
            Offset[0.2]}, "RowsIndexed" -> {}}],
       "Piecewise",
       DeleteWithContents->True,
       Editable->False,
       SelectWithContents->True,
       Selectable->False]}]}], "}"}]}], "}"}]], "Output",
 CellChangeTimes->{{3.594800841995028*^9, 3.5948008613912983`*^9}, 
   3.594800910434614*^9}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{
   TagBox[GridBox[{
      {"\[Piecewise]", GridBox[{
         {"0", 
          RowBox[{
           RowBox[{"(", 
            RowBox[{
             RowBox[{"R", ">", "0"}], "&&", 
             RowBox[{"Q", "\[Equal]", "0"}]}], ")"}], "||", 
           RowBox[{"(", 
            RowBox[{
             RowBox[{"R", "\[Equal]", "0"}], "&&", 
             RowBox[{"Q", ">", "0"}], "&&", 
             RowBox[{"xk0", "\[Equal]", "1"}]}], ")"}], "||", 
           RowBox[{"(", 
            RowBox[{
             RowBox[{"R", "\[Equal]", "0"}], "&&", 
             RowBox[{"Q", ">", "0"}], "&&", 
             RowBox[{
              RowBox[{"-", "1"}], "<", "xk0", "<", "1"}]}], ")"}], "||", 
           RowBox[{"(", 
            RowBox[{
             RowBox[{"R", ">", "0"}], "&&", 
             RowBox[{"Q", ">", "0"}], "&&", 
             RowBox[{"xk0", "\[Equal]", 
              FractionBox[
               RowBox[{
                RowBox[{"-", "Q"}], "-", "R"}], "Q"]}]}], ")"}], "||", 
           RowBox[{"(", 
            RowBox[{
             RowBox[{"R", ">", "0"}], "&&", 
             RowBox[{"Q", ">", "0"}], "&&", 
             RowBox[{"xk0", "\[Equal]", 
              FractionBox[
               RowBox[{"Q", "+", "R"}], "Q"]}]}], ")"}], "||", 
           RowBox[{"(", 
            RowBox[{
             RowBox[{"R", "<", "0"}], "&&", 
             RowBox[{"Q", ">", "0"}], "&&", 
             RowBox[{
              FractionBox[
               RowBox[{
                RowBox[{"-", "Q"}], "-", "R"}], "Q"], "<", "xk0", "<", 
              FractionBox[
               RowBox[{"Q", "+", "R"}], "Q"]}]}], ")"}]}]},
         {
          FractionBox[
           RowBox[{
            SuperscriptBox["Q", "2"], "-", 
            RowBox[{"2", " ", 
             SuperscriptBox["Q", "2"], " ", "xk0"}], "+", 
            RowBox[{
             SuperscriptBox["Q", "2"], " ", 
             SuperscriptBox["xk0", "2"]}]}], "Q"], 
          RowBox[{
           RowBox[{"R", "\[Equal]", "0"}], "&&", 
           RowBox[{"Q", ">", "0"}], "&&", 
           RowBox[{"xk0", ">", "1"}]}]},
         {
          FractionBox[
           RowBox[{
            SuperscriptBox["Q", "2"], "+", 
            RowBox[{"2", " ", 
             SuperscriptBox["Q", "2"], " ", "xk0"}], "+", 
            RowBox[{
             SuperscriptBox["Q", "2"], " ", 
             SuperscriptBox["xk0", "2"]}]}], "Q"], 
          RowBox[{
           RowBox[{"R", "\[Equal]", "0"}], "&&", 
           RowBox[{"Q", ">", "0"}], "&&", 
           RowBox[{"xk0", "\[LessEqual]", 
            RowBox[{"-", "1"}]}]}]},
         {
          FractionBox[
           RowBox[{
            SuperscriptBox["Q", "2"], "+", 
            RowBox[{"2", " ", "Q", " ", "R"}], "+", 
            SuperscriptBox["R", "2"], "-", 
            RowBox[{"2", " ", 
             SuperscriptBox["Q", "2"], " ", "xk0"}], "-", 
            RowBox[{"2", " ", "Q", " ", "R", " ", "xk0"}], "+", 
            RowBox[{
             SuperscriptBox["Q", "2"], " ", 
             SuperscriptBox["xk0", "2"]}]}], 
           RowBox[{"Q", "+", "R"}]], 
          RowBox[{
           RowBox[{"R", ">", "0"}], "&&", 
           RowBox[{"Q", ">", "0"}], "&&", 
           RowBox[{"xk0", ">", 
            FractionBox[
             RowBox[{"Q", "+", "R"}], "Q"]}]}]},
         {
          FractionBox[
           RowBox[{
            SuperscriptBox["Q", "2"], "+", 
            RowBox[{"2", " ", "Q", " ", "R"}], "+", 
            SuperscriptBox["R", "2"], "+", 
            RowBox[{"2", " ", 
             SuperscriptBox["Q", "2"], " ", "xk0"}], "+", 
            RowBox[{"2", " ", "Q", " ", "R", " ", "xk0"}], "+", 
            RowBox[{
             SuperscriptBox["Q", "2"], " ", 
             SuperscriptBox["xk0", "2"]}]}], 
           RowBox[{"Q", "+", "R"}]], 
          RowBox[{
           RowBox[{"R", ">", "0"}], "&&", 
           RowBox[{"Q", ">", "0"}], "&&", 
           RowBox[{"xk0", "<", 
            FractionBox[
             RowBox[{
              RowBox[{"-", "Q"}], "-", "R"}], "Q"]}]}]},
         {"\[Infinity]", 
          TagBox["True",
           "PiecewiseDefault",
           AutoDelete->True]}
        },
        AllowedDimensions->{2, Automatic},
        Editable->True,
        GridBoxAlignment->{
         "Columns" -> {{Left}}, "ColumnsIndexed" -> {}, 
          "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
        GridBoxItemSize->{
         "Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, "Rows" -> {{1.}},
           "RowsIndexed" -> {}},
        GridBoxSpacings->{"Columns" -> {
            Offset[0.27999999999999997`], {
             Offset[0.84]}, 
            Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, 
          "Rows" -> {
            Offset[0.2], {
             Offset[0.4]}, 
            Offset[0.2]}, "RowsIndexed" -> {}},
        Selectable->True]}
     },
     GridBoxAlignment->{
      "Columns" -> {{Left}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, 
       "RowsIndexed" -> {}},
     GridBoxItemSize->{
      "Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, "Rows" -> {{1.}}, 
       "RowsIndexed" -> {}},
     GridBoxSpacings->{"Columns" -> {
         Offset[0.27999999999999997`], {
          Offset[0.35]}, 
         Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
         Offset[0.2], {
          Offset[0.4]}, 
         Offset[0.2]}, "RowsIndexed" -> {}}],
    "Piecewise",
    DeleteWithContents->True,
    Editable->False,
    SelectWithContents->True,
    Selectable->False], ",", 
   RowBox[{"{", 
    RowBox[{
     RowBox[{"uk", "\[Rule]", 
      TagBox[GridBox[{
         {"\[Piecewise]", GridBox[{
            {
             RowBox[{"-", "1"}], 
             RowBox[{
              RowBox[{"(", 
               RowBox[{
                RowBox[{"R", "\[Equal]", "0"}], "&&", 
                RowBox[{"Q", ">", "0"}], "&&", 
                RowBox[{"xk0", "\[Equal]", "1"}]}], ")"}], "||", 
              RowBox[{"(", 
               RowBox[{
                RowBox[{"R", "\[Equal]", "0"}], "&&", 
                RowBox[{"Q", ">", "0"}], "&&", 
                RowBox[{"xk0", ">", "1"}]}], ")"}], "||", 
              RowBox[{"(", 
               RowBox[{
                RowBox[{"R", ">", "0"}], "&&", 
                RowBox[{"Q", ">", "0"}], "&&", 
                RowBox[{"xk0", "\[Equal]", 
                 FractionBox[
                  RowBox[{"Q", "+", "R"}], "Q"]}]}], ")"}], "||", 
              RowBox[{"(", 
               RowBox[{
                RowBox[{"R", ">", "0"}], "&&", 
                RowBox[{"Q", ">", "0"}], "&&", 
                RowBox[{"xk0", ">", 
                 FractionBox[
                  RowBox[{"Q", "+", "R"}], "Q"]}]}], ")"}]}]},
            {"0", 
             RowBox[{
              RowBox[{"R", ">", "0"}], "&&", 
              RowBox[{"Q", "\[Equal]", "0"}]}]},
            {"1", 
             RowBox[{
              RowBox[{"(", 
               RowBox[{
                RowBox[{"R", "\[Equal]", "0"}], "&&", 
                RowBox[{"Q", ">", "0"}], "&&", 
                RowBox[{"xk0", "\[LessEqual]", 
                 RowBox[{"-", "1"}]}]}], ")"}], "||", 
              RowBox[{"(", 
               RowBox[{
                RowBox[{"R", ">", "0"}], "&&", 
                RowBox[{"Q", ">", "0"}], "&&", 
                RowBox[{"xk0", "\[Equal]", 
                 FractionBox[
                  RowBox[{
                   RowBox[{"-", "Q"}], "-", "R"}], "Q"]}]}], ")"}], "||", 
              RowBox[{"(", 
               RowBox[{
                RowBox[{"R", ">", "0"}], "&&", 
                RowBox[{"Q", ">", "0"}], "&&", 
                RowBox[{"xk0", "<", 
                 FractionBox[
                  RowBox[{
                   RowBox[{"-", "Q"}], "-", "R"}], "Q"]}]}], ")"}]}]},
            {
             RowBox[{"-", "xk0"}], 
             RowBox[{
              RowBox[{"R", "\[Equal]", "0"}], "&&", 
              RowBox[{"Q", ">", "0"}], "&&", 
              RowBox[{
               RowBox[{"-", "1"}], "<", "xk0", "<", "1"}]}]},
            {
             RowBox[{"-", 
              FractionBox[
               RowBox[{"Q", " ", "xk0"}], 
               RowBox[{"Q", "+", "R"}]]}], 
             RowBox[{
              RowBox[{"R", ">", "0"}], "&&", 
              RowBox[{"Q", ">", "0"}], "&&", 
              RowBox[{
               FractionBox[
                RowBox[{
                 RowBox[{"-", "Q"}], "-", "R"}], "Q"], "<", "xk0", "<", 
               FractionBox[
                RowBox[{"Q", "+", "R"}], "Q"]}]}]},
            {"Indeterminate", 
             TagBox["True",
              "PiecewiseDefault",
              AutoDelete->True]}
           },
           AllowedDimensions->{2, Automatic},
           Editable->True,
           
           GridBoxAlignment->{
            "Columns" -> {{Left}}, "ColumnsIndexed" -> {}, 
             "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
           
           GridBoxItemSize->{
            "Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, 
             "Rows" -> {{1.}}, "RowsIndexed" -> {}},
           GridBoxSpacings->{"Columns" -> {
               Offset[0.27999999999999997`], {
                Offset[0.84]}, 
               Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
               Offset[0.2], {
                Offset[0.4]}, 
               Offset[0.2]}, "RowsIndexed" -> {}},
           Selectable->True]}
        },
        GridBoxAlignment->{
         "Columns" -> {{Left}}, "ColumnsIndexed" -> {}, 
          "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
        GridBoxItemSize->{
         "Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, "Rows" -> {{1.}},
           "RowsIndexed" -> {}},
        GridBoxSpacings->{"Columns" -> {
            Offset[0.27999999999999997`], {
             Offset[0.35]}, 
            Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, 
          "Rows" -> {
            Offset[0.2], {
             Offset[0.4]}, 
            Offset[0.2]}, "RowsIndexed" -> {}}],
       "Piecewise",
       DeleteWithContents->True,
       Editable->False,
       SelectWithContents->True,
       Selectable->False]}], ",", 
     RowBox[{"uk1", "\[Rule]", 
      TagBox[GridBox[{
         {"\[Piecewise]", GridBox[{
            {"0", 
             RowBox[{
              RowBox[{"(", 
               RowBox[{
                RowBox[{"R", ">", "0"}], "&&", 
                RowBox[{"Q", "\[Equal]", "0"}]}], ")"}], "||", 
              RowBox[{"(", 
               RowBox[{
                RowBox[{"R", "\[Equal]", "0"}], "&&", 
                RowBox[{"Q", ">", "0"}], "&&", 
                RowBox[{"xk0", "\[Equal]", "1"}]}], ")"}], "||", 
              RowBox[{"(", 
               RowBox[{
                RowBox[{"R", "\[Equal]", "0"}], "&&", 
                RowBox[{"Q", ">", "0"}], "&&", 
                RowBox[{"xk0", ">", "1"}]}], ")"}], "||", 
              RowBox[{"(", 
               RowBox[{
                RowBox[{"R", "\[Equal]", "0"}], "&&", 
                RowBox[{"Q", ">", "0"}], "&&", 
                RowBox[{
                 RowBox[{"-", "1"}], "<", "xk0", "<", "1"}]}], ")"}], "||", 
              RowBox[{"(", 
               RowBox[{
                RowBox[{"R", "\[Equal]", "0"}], "&&", 
                RowBox[{"Q", ">", "0"}], "&&", 
                RowBox[{"xk0", "\[LessEqual]", 
                 RowBox[{"-", "1"}]}]}], ")"}]}]},
            {
             RowBox[{"-", 
              SqrtBox[
               FractionBox[
                RowBox[{
                 RowBox[{"-", 
                  SuperscriptBox["Q", "2"]}], "-", 
                 RowBox[{"2", " ", "Q", " ", "R"}], "-", 
                 SuperscriptBox["R", "2"], "-", 
                 RowBox[{"2", " ", 
                  SuperscriptBox["Q", "2"], " ", "xk0"}], "-", 
                 RowBox[{"2", " ", "Q", " ", "R", " ", "xk0"}], "-", 
                 RowBox[{
                  SuperscriptBox["Q", "2"], " ", 
                  SuperscriptBox["xk0", "2"]}]}], 
                RowBox[{"R", " ", 
                 RowBox[{"(", 
                  RowBox[{"Q", "+", "R"}], ")"}]}]]]}], 
             RowBox[{
              RowBox[{"R", ">", "0"}], "&&", 
              RowBox[{"Q", ">", "0"}], "&&", 
              RowBox[{"xk0", "\[Equal]", 
               FractionBox[
                RowBox[{
                 RowBox[{"-", "Q"}], "-", "R"}], "Q"]}]}]},
            {
             RowBox[{"-", 
              SqrtBox[
               FractionBox[
                RowBox[{
                 RowBox[{"-", 
                  SuperscriptBox["Q", "2"]}], "-", 
                 RowBox[{"2", " ", "Q", " ", "R"}], "-", 
                 SuperscriptBox["R", "2"], "+", 
                 RowBox[{"2", " ", 
                  SuperscriptBox["Q", "2"], " ", "xk0"}], "+", 
                 RowBox[{"2", " ", "Q", " ", "R", " ", "xk0"}], "-", 
                 RowBox[{
                  SuperscriptBox["Q", "2"], " ", 
                  SuperscriptBox["xk0", "2"]}]}], 
                RowBox[{"R", " ", 
                 RowBox[{"(", 
                  RowBox[{"Q", "+", "R"}], ")"}]}]]]}], 
             RowBox[{
              RowBox[{"R", ">", "0"}], "&&", 
              RowBox[{"Q", ">", "0"}], "&&", 
              RowBox[{"xk0", "\[Equal]", 
               FractionBox[
                RowBox[{"Q", "+", "R"}], "Q"]}]}]},
            {
             RowBox[{"-", 
              SqrtBox[
               FractionBox[
                RowBox[{
                 RowBox[{
                  RowBox[{"-", 
                   SuperscriptBox["Q", "2"]}], " ", 
                  SuperscriptBox["xk0", "2"]}], "-", 
                 FractionBox[
                  RowBox[{
                   SuperscriptBox["Q", "4"], " ", 
                   SuperscriptBox["xk0", "2"]}], 
                  SuperscriptBox[
                   RowBox[{"(", 
                    RowBox[{"Q", "+", "R"}], ")"}], "2"]], "-", 
                 FractionBox[
                  RowBox[{"2", " ", 
                   SuperscriptBox["Q", "3"], " ", "R", " ", 
                   SuperscriptBox["xk0", "2"]}], 
                  SuperscriptBox[
                   RowBox[{"(", 
                    RowBox[{"Q", "+", "R"}], ")"}], "2"]], "-", 
                 FractionBox[
                  RowBox[{
                   SuperscriptBox["Q", "2"], " ", 
                   SuperscriptBox["R", "2"], " ", 
                   SuperscriptBox["xk0", "2"]}], 
                  SuperscriptBox[
                   RowBox[{"(", 
                    RowBox[{"Q", "+", "R"}], ")"}], "2"]], "+", 
                 FractionBox[
                  RowBox[{"2", " ", 
                   SuperscriptBox["Q", "3"], " ", 
                   SuperscriptBox["xk0", "2"]}], 
                  RowBox[{"Q", "+", "R"}]], "+", 
                 FractionBox[
                  RowBox[{"2", " ", 
                   SuperscriptBox["Q", "2"], " ", "R", " ", 
                   SuperscriptBox["xk0", "2"]}], 
                  RowBox[{"Q", "+", "R"}]]}], 
                RowBox[{"R", " ", 
                 RowBox[{"(", 
                  RowBox[{"Q", "+", "R"}], ")"}]}]]]}], 
             RowBox[{
              RowBox[{"R", ">", "0"}], "&&", 
              RowBox[{"Q", ">", "0"}], "&&", 
              RowBox[{
               FractionBox[
                RowBox[{
                 RowBox[{"-", "Q"}], "-", "R"}], "Q"], "<", "xk0", "<", 
               FractionBox[
                RowBox[{"Q", "+", "R"}], "Q"]}]}]},
            {
             RowBox[{"-", 
              RowBox[{"\[Sqrt]", 
               RowBox[{"(", 
                RowBox[{
                 RowBox[{"1", "/", 
                  RowBox[{"(", 
                   RowBox[{"R", " ", 
                    RowBox[{"(", 
                    RowBox[{"Q", "+", "R"}], ")"}]}], ")"}]}], 
                 RowBox[{"(", 
                  RowBox[{
                   RowBox[{"-", 
                    SuperscriptBox["Q", "2"]}], "-", 
                   RowBox[{"2", " ", "Q", " ", "R"}], "-", 
                   SuperscriptBox["R", "2"], "+", 
                   RowBox[{"2", " ", 
                    SuperscriptBox["Q", "2"], " ", "xk0"}], "+", 
                   RowBox[{"2", " ", "Q", " ", "R", " ", "xk0"}], "-", 
                   RowBox[{
                    SuperscriptBox["Q", "2"], " ", 
                    SuperscriptBox["xk0", "2"]}], "+", 
                   FractionBox[
                    RowBox[{"Q", " ", 
                    RowBox[{"(", 
                    RowBox[{
                    SuperscriptBox["Q", "2"], "+", 
                    RowBox[{"2", " ", "Q", " ", "R"}], "+", 
                    SuperscriptBox["R", "2"], "-", 
                    RowBox[{"2", " ", 
                    SuperscriptBox["Q", "2"], " ", "xk0"}], "-", 
                    RowBox[{"2", " ", "Q", " ", "R", " ", "xk0"}], "+", 
                    RowBox[{
                    SuperscriptBox["Q", "2"], " ", 
                    SuperscriptBox["xk0", "2"]}]}], ")"}]}], 
                    RowBox[{"Q", "+", "R"}]], "+", 
                   FractionBox[
                    RowBox[{"R", " ", 
                    RowBox[{"(", 
                    RowBox[{
                    SuperscriptBox["Q", "2"], "+", 
                    RowBox[{"2", " ", "Q", " ", "R"}], "+", 
                    SuperscriptBox["R", "2"], "-", 
                    RowBox[{"2", " ", 
                    SuperscriptBox["Q", "2"], " ", "xk0"}], "-", 
                    RowBox[{"2", " ", "Q", " ", "R", " ", "xk0"}], "+", 
                    RowBox[{
                    SuperscriptBox["Q", "2"], " ", 
                    SuperscriptBox["xk0", "2"]}]}], ")"}]}], 
                    RowBox[{"Q", "+", "R"}]]}], ")"}]}], ")"}]}]}], 
             RowBox[{
              RowBox[{"R", ">", "0"}], "&&", 
              RowBox[{"Q", ">", "0"}], "&&", 
              RowBox[{"xk0", ">", 
               FractionBox[
                RowBox[{"Q", "+", "R"}], "Q"]}]}]},
            {
             RowBox[{"-", 
              RowBox[{"\[Sqrt]", 
               RowBox[{"(", 
                RowBox[{
                 RowBox[{"1", "/", 
                  RowBox[{"(", 
                   RowBox[{"R", " ", 
                    RowBox[{"(", 
                    RowBox[{"Q", "+", "R"}], ")"}]}], ")"}]}], 
                 RowBox[{"(", 
                  RowBox[{
                   RowBox[{"-", 
                    SuperscriptBox["Q", "2"]}], "-", 
                   RowBox[{"2", " ", "Q", " ", "R"}], "-", 
                   SuperscriptBox["R", "2"], "-", 
                   RowBox[{"2", " ", 
                    SuperscriptBox["Q", "2"], " ", "xk0"}], "-", 
                   RowBox[{"2", " ", "Q", " ", "R", " ", "xk0"}], "-", 
                   RowBox[{
                    SuperscriptBox["Q", "2"], " ", 
                    SuperscriptBox["xk0", "2"]}], "+", 
                   FractionBox[
                    RowBox[{"Q", " ", 
                    RowBox[{"(", 
                    RowBox[{
                    SuperscriptBox["Q", "2"], "+", 
                    RowBox[{"2", " ", "Q", " ", "R"}], "+", 
                    SuperscriptBox["R", "2"], "+", 
                    RowBox[{"2", " ", 
                    SuperscriptBox["Q", "2"], " ", "xk0"}], "+", 
                    RowBox[{"2", " ", "Q", " ", "R", " ", "xk0"}], "+", 
                    RowBox[{
                    SuperscriptBox["Q", "2"], " ", 
                    SuperscriptBox["xk0", "2"]}]}], ")"}]}], 
                    RowBox[{"Q", "+", "R"}]], "+", 
                   FractionBox[
                    RowBox[{"R", " ", 
                    RowBox[{"(", 
                    RowBox[{
                    SuperscriptBox["Q", "2"], "+", 
                    RowBox[{"2", " ", "Q", " ", "R"}], "+", 
                    SuperscriptBox["R", "2"], "+", 
                    RowBox[{"2", " ", 
                    SuperscriptBox["Q", "2"], " ", "xk0"}], "+", 
                    RowBox[{"2", " ", "Q", " ", "R", " ", "xk0"}], "+", 
                    RowBox[{
                    SuperscriptBox["Q", "2"], " ", 
                    SuperscriptBox["xk0", "2"]}]}], ")"}]}], 
                    RowBox[{"Q", "+", "R"}]]}], ")"}]}], ")"}]}]}], 
             RowBox[{
              RowBox[{"R", ">", "0"}], "&&", 
              RowBox[{"Q", ">", "0"}], "&&", 
              RowBox[{"xk0", "<", 
               FractionBox[
                RowBox[{
                 RowBox[{"-", "Q"}], "-", "R"}], "Q"]}]}]},
            {"Indeterminate", 
             TagBox["True",
              "PiecewiseDefault",
              AutoDelete->True]}
           },
           AllowedDimensions->{2, Automatic},
           Editable->True,
           
           GridBoxAlignment->{
            "Columns" -> {{Left}}, "ColumnsIndexed" -> {}, 
             "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
           
           GridBoxItemSize->{
            "Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, 
             "Rows" -> {{1.}}, "RowsIndexed" -> {}},
           GridBoxSpacings->{"Columns" -> {
               Offset[0.27999999999999997`], {
                Offset[0.84]}, 
               Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
               Offset[0.2], {
                Offset[0.4]}, 
               Offset[0.2]}, "RowsIndexed" -> {}},
           Selectable->True]}
        },
        GridBoxAlignment->{
         "Columns" -> {{Left}}, "ColumnsIndexed" -> {}, 
          "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
        GridBoxItemSize->{
         "Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, "Rows" -> {{1.}},
           "RowsIndexed" -> {}},
        GridBoxSpacings->{"Columns" -> {
            Offset[0.27999999999999997`], {
             Offset[0.35]}, 
            Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, 
          "Rows" -> {
            Offset[0.2], {
             Offset[0.4]}, 
            Offset[0.2]}, "RowsIndexed" -> {}}],
       "Piecewise",
       DeleteWithContents->True,
       Editable->False,
       SelectWithContents->True,
       Selectable->False]}]}], "}"}]}], "}"}]], "Input",
 CellChangeTimes->{{3.594800829872805*^9, 3.5948008300015*^9}}],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{
   TagBox[GridBox[{
      {"\[Piecewise]", GridBox[{
         {"0", 
          RowBox[{
           RowBox[{"(", 
            RowBox[{
             RowBox[{"R", ">", "0"}], "&&", 
             RowBox[{"Q", "\[Equal]", "0"}]}], ")"}], "||", 
           RowBox[{"(", 
            RowBox[{
             RowBox[{"R", "\[Equal]", "0"}], "&&", 
             RowBox[{"Q", ">", "0"}], "&&", 
             RowBox[{"xk0", "\[Equal]", "1"}]}], ")"}], "||", 
           RowBox[{"(", 
            RowBox[{
             RowBox[{"R", "\[Equal]", "0"}], "&&", 
             RowBox[{"Q", ">", "0"}], "&&", 
             RowBox[{
              RowBox[{"-", "1"}], "<", "xk0", "<", "1"}]}], ")"}], "||", 
           RowBox[{"(", 
            RowBox[{
             RowBox[{"R", ">", "0"}], "&&", 
             RowBox[{"Q", ">", "0"}], "&&", 
             RowBox[{"xk0", "\[Equal]", 
              FractionBox[
               RowBox[{
                RowBox[{"-", "Q"}], "-", "R"}], "Q"]}]}], ")"}], "||", 
           RowBox[{"(", 
            RowBox[{
             RowBox[{"R", ">", "0"}], "&&", 
             RowBox[{"Q", ">", "0"}], "&&", 
             RowBox[{"xk0", "\[Equal]", 
              FractionBox[
               RowBox[{"Q", "+", "R"}], "Q"]}]}], ")"}], "||", 
           RowBox[{"(", 
            RowBox[{
             RowBox[{"R", "<", "0"}], "&&", 
             RowBox[{"Q", ">", "0"}], "&&", 
             RowBox[{
              FractionBox[
               RowBox[{
                RowBox[{"-", "Q"}], "-", "R"}], "Q"], "<", "xk0", "<", 
              FractionBox[
               RowBox[{"Q", "+", "R"}], "Q"]}]}], ")"}]}]},
         {
          FractionBox[
           RowBox[{
            SuperscriptBox["Q", "2"], "-", 
            RowBox[{"2", " ", 
             SuperscriptBox["Q", "2"], " ", "xk0"}], "+", 
            RowBox[{
             SuperscriptBox["Q", "2"], " ", 
             SuperscriptBox["xk0", "2"]}]}], "Q"], 
          RowBox[{
           RowBox[{"R", "\[Equal]", "0"}], "&&", 
           RowBox[{"Q", ">", "0"}], "&&", 
           RowBox[{"xk0", ">", "1"}]}]},
         {
          FractionBox[
           RowBox[{
            SuperscriptBox["Q", "2"], "+", 
            RowBox[{"2", " ", 
             SuperscriptBox["Q", "2"], " ", "xk0"}], "+", 
            RowBox[{
             SuperscriptBox["Q", "2"], " ", 
             SuperscriptBox["xk0", "2"]}]}], "Q"], 
          RowBox[{
           RowBox[{"R", "\[Equal]", "0"}], "&&", 
           RowBox[{"Q", ">", "0"}], "&&", 
           RowBox[{"xk0", "\[LessEqual]", 
            RowBox[{"-", "1"}]}]}]},
         {
          FractionBox[
           RowBox[{
            SuperscriptBox["Q", "2"], "+", 
            RowBox[{"2", " ", "Q", " ", "R"}], "+", 
            SuperscriptBox["R", "2"], "-", 
            RowBox[{"2", " ", 
             SuperscriptBox["Q", "2"], " ", "xk0"}], "-", 
            RowBox[{"2", " ", "Q", " ", "R", " ", "xk0"}], "+", 
            RowBox[{
             SuperscriptBox["Q", "2"], " ", 
             SuperscriptBox["xk0", "2"]}]}], 
           RowBox[{"Q", "+", "R"}]], 
          RowBox[{
           RowBox[{"R", ">", "0"}], "&&", 
           RowBox[{"Q", ">", "0"}], "&&", 
           RowBox[{"xk0", ">", 
            FractionBox[
             RowBox[{"Q", "+", "R"}], "Q"]}]}]},
         {
          FractionBox[
           RowBox[{
            SuperscriptBox["Q", "2"], "+", 
            RowBox[{"2", " ", "Q", " ", "R"}], "+", 
            SuperscriptBox["R", "2"], "+", 
            RowBox[{"2", " ", 
             SuperscriptBox["Q", "2"], " ", "xk0"}], "+", 
            RowBox[{"2", " ", "Q", " ", "R", " ", "xk0"}], "+", 
            RowBox[{
             SuperscriptBox["Q", "2"], " ", 
             SuperscriptBox["xk0", "2"]}]}], 
           RowBox[{"Q", "+", "R"}]], 
          RowBox[{
           RowBox[{"R", ">", "0"}], "&&", 
           RowBox[{"Q", ">", "0"}], "&&", 
           RowBox[{"xk0", "<", 
            FractionBox[
             RowBox[{
              RowBox[{"-", "Q"}], "-", "R"}], "Q"]}]}]},
         {"\[Infinity]", 
          TagBox["True",
           "PiecewiseDefault",
           AutoDelete->True]}
        },
        AllowedDimensions->{2, Automatic},
        Editable->True,
        GridBoxAlignment->{
         "Columns" -> {{Left}}, "ColumnsIndexed" -> {}, 
          "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
        GridBoxItemSize->{
         "Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, "Rows" -> {{1.}},
           "RowsIndexed" -> {}},
        GridBoxSpacings->{"Columns" -> {
            Offset[0.27999999999999997`], {
             Offset[0.84]}, 
            Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, 
          "Rows" -> {
            Offset[0.2], {
             Offset[0.4]}, 
            Offset[0.2]}, "RowsIndexed" -> {}},
        Selectable->True]}
     },
     GridBoxAlignment->{
      "Columns" -> {{Left}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, 
       "RowsIndexed" -> {}},
     GridBoxItemSize->{
      "Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, "Rows" -> {{1.}}, 
       "RowsIndexed" -> {}},
     GridBoxSpacings->{"Columns" -> {
         Offset[0.27999999999999997`], {
          Offset[0.35]}, 
         Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
         Offset[0.2], {
          Offset[0.4]}, 
         Offset[0.2]}, "RowsIndexed" -> {}}],
    "Piecewise",
    DeleteWithContents->True,
    Editable->False,
    SelectWithContents->True,
    Selectable->False], ",", 
   RowBox[{"{", 
    RowBox[{
     RowBox[{"uk", "\[Rule]", 
      TagBox[GridBox[{
         {"\[Piecewise]", GridBox[{
            {
             RowBox[{"-", "1"}], 
             RowBox[{
              RowBox[{"(", 
               RowBox[{
                RowBox[{"R", "\[Equal]", "0"}], "&&", 
                RowBox[{"Q", ">", "0"}], "&&", 
                RowBox[{"xk0", "\[Equal]", "1"}]}], ")"}], "||", 
              RowBox[{"(", 
               RowBox[{
                RowBox[{"R", "\[Equal]", "0"}], "&&", 
                RowBox[{"Q", ">", "0"}], "&&", 
                RowBox[{"xk0", ">", "1"}]}], ")"}], "||", 
              RowBox[{"(", 
               RowBox[{
                RowBox[{"R", ">", "0"}], "&&", 
                RowBox[{"Q", ">", "0"}], "&&", 
                RowBox[{"xk0", "\[Equal]", 
                 FractionBox[
                  RowBox[{"Q", "+", "R"}], "Q"]}]}], ")"}], "||", 
              RowBox[{"(", 
               RowBox[{
                RowBox[{"R", ">", "0"}], "&&", 
                RowBox[{"Q", ">", "0"}], "&&", 
                RowBox[{"xk0", ">", 
                 FractionBox[
                  RowBox[{"Q", "+", "R"}], "Q"]}]}], ")"}]}]},
            {"0", 
             RowBox[{
              RowBox[{"R", ">", "0"}], "&&", 
              RowBox[{"Q", "\[Equal]", "0"}]}]},
            {"1", 
             RowBox[{
              RowBox[{"(", 
               RowBox[{
                RowBox[{"R", "\[Equal]", "0"}], "&&", 
                RowBox[{"Q", ">", "0"}], "&&", 
                RowBox[{"xk0", "\[LessEqual]", 
                 RowBox[{"-", "1"}]}]}], ")"}], "||", 
              RowBox[{"(", 
               RowBox[{
                RowBox[{"R", ">", "0"}], "&&", 
                RowBox[{"Q", ">", "0"}], "&&", 
                RowBox[{"xk0", "\[Equal]", 
                 FractionBox[
                  RowBox[{
                   RowBox[{"-", "Q"}], "-", "R"}], "Q"]}]}], ")"}], "||", 
              RowBox[{"(", 
               RowBox[{
                RowBox[{"R", ">", "0"}], "&&", 
                RowBox[{"Q", ">", "0"}], "&&", 
                RowBox[{"xk0", "<", 
                 FractionBox[
                  RowBox[{
                   RowBox[{"-", "Q"}], "-", "R"}], "Q"]}]}], ")"}]}]},
            {
             RowBox[{"-", "xk0"}], 
             RowBox[{
              RowBox[{"R", "\[Equal]", "0"}], "&&", 
              RowBox[{"Q", ">", "0"}], "&&", 
              RowBox[{
               RowBox[{"-", "1"}], "<", "xk0", "<", "1"}]}]},
            {
             RowBox[{"-", 
              FractionBox[
               RowBox[{"Q", " ", "xk0"}], 
               RowBox[{"Q", "+", "R"}]]}], 
             RowBox[{
              RowBox[{"R", ">", "0"}], "&&", 
              RowBox[{"Q", ">", "0"}], "&&", 
              RowBox[{
               FractionBox[
                RowBox[{
                 RowBox[{"-", "Q"}], "-", "R"}], "Q"], "<", "xk0", "<", 
               FractionBox[
                RowBox[{"Q", "+", "R"}], "Q"]}]}]},
            {"Indeterminate", 
             TagBox["True",
              "PiecewiseDefault",
              AutoDelete->True]}
           },
           AllowedDimensions->{2, Automatic},
           Editable->True,
           
           GridBoxAlignment->{
            "Columns" -> {{Left}}, "ColumnsIndexed" -> {}, 
             "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
           
           GridBoxItemSize->{
            "Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, 
             "Rows" -> {{1.}}, "RowsIndexed" -> {}},
           GridBoxSpacings->{"Columns" -> {
               Offset[0.27999999999999997`], {
                Offset[0.84]}, 
               Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
               Offset[0.2], {
                Offset[0.4]}, 
               Offset[0.2]}, "RowsIndexed" -> {}},
           Selectable->True]}
        },
        GridBoxAlignment->{
         "Columns" -> {{Left}}, "ColumnsIndexed" -> {}, 
          "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
        GridBoxItemSize->{
         "Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, "Rows" -> {{1.}},
           "RowsIndexed" -> {}},
        GridBoxSpacings->{"Columns" -> {
            Offset[0.27999999999999997`], {
             Offset[0.35]}, 
            Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, 
          "Rows" -> {
            Offset[0.2], {
             Offset[0.4]}, 
            Offset[0.2]}, "RowsIndexed" -> {}}],
       "Piecewise",
       DeleteWithContents->True,
       Editable->False,
       SelectWithContents->True,
       Selectable->False]}], ",", 
     RowBox[{"uk1", "\[Rule]", 
      TagBox[GridBox[{
         {"\[Piecewise]", GridBox[{
            {"0", 
             RowBox[{
              RowBox[{"(", 
               RowBox[{
                RowBox[{"R", ">", "0"}], "&&", 
                RowBox[{"Q", "\[Equal]", "0"}]}], ")"}], "||", 
              RowBox[{"(", 
               RowBox[{
                RowBox[{"R", "\[Equal]", "0"}], "&&", 
                RowBox[{"Q", ">", "0"}], "&&", 
                RowBox[{"xk0", "\[Equal]", "1"}]}], ")"}], "||", 
              RowBox[{"(", 
               RowBox[{
                RowBox[{"R", "\[Equal]", "0"}], "&&", 
                RowBox[{"Q", ">", "0"}], "&&", 
                RowBox[{"xk0", ">", "1"}]}], ")"}], "||", 
              RowBox[{"(", 
               RowBox[{
                RowBox[{"R", "\[Equal]", "0"}], "&&", 
                RowBox[{"Q", ">", "0"}], "&&", 
                RowBox[{
                 RowBox[{"-", "1"}], "<", "xk0", "<", "1"}]}], ")"}], "||", 
              RowBox[{"(", 
               RowBox[{
                RowBox[{"R", "\[Equal]", "0"}], "&&", 
                RowBox[{"Q", ">", "0"}], "&&", 
                RowBox[{"xk0", "\[LessEqual]", 
                 RowBox[{"-", "1"}]}]}], ")"}]}]},
            {
             RowBox[{"-", 
              SqrtBox[
               FractionBox[
                RowBox[{
                 RowBox[{"-", 
                  SuperscriptBox["Q", "2"]}], "-", 
                 RowBox[{"2", " ", "Q", " ", "R"}], "-", 
                 SuperscriptBox["R", "2"], "-", 
                 RowBox[{"2", " ", 
                  SuperscriptBox["Q", "2"], " ", "xk0"}], "-", 
                 RowBox[{"2", " ", "Q", " ", "R", " ", "xk0"}], "-", 
                 RowBox[{
                  SuperscriptBox["Q", "2"], " ", 
                  SuperscriptBox["xk0", "2"]}]}], 
                RowBox[{"R", " ", 
                 RowBox[{"(", 
                  RowBox[{"Q", "+", "R"}], ")"}]}]]]}], 
             RowBox[{
              RowBox[{"R", ">", "0"}], "&&", 
              RowBox[{"Q", ">", "0"}], "&&", 
              RowBox[{"xk0", "\[Equal]", 
               FractionBox[
                RowBox[{
                 RowBox[{"-", "Q"}], "-", "R"}], "Q"]}]}]},
            {
             RowBox[{"-", 
              SqrtBox[
               FractionBox[
                RowBox[{
                 RowBox[{"-", 
                  SuperscriptBox["Q", "2"]}], "-", 
                 RowBox[{"2", " ", "Q", " ", "R"}], "-", 
                 SuperscriptBox["R", "2"], "+", 
                 RowBox[{"2", " ", 
                  SuperscriptBox["Q", "2"], " ", "xk0"}], "+", 
                 RowBox[{"2", " ", "Q", " ", "R", " ", "xk0"}], "-", 
                 RowBox[{
                  SuperscriptBox["Q", "2"], " ", 
                  SuperscriptBox["xk0", "2"]}]}], 
                RowBox[{"R", " ", 
                 RowBox[{"(", 
                  RowBox[{"Q", "+", "R"}], ")"}]}]]]}], 
             RowBox[{
              RowBox[{"R", ">", "0"}], "&&", 
              RowBox[{"Q", ">", "0"}], "&&", 
              RowBox[{"xk0", "\[Equal]", 
               FractionBox[
                RowBox[{"Q", "+", "R"}], "Q"]}]}]},
            {
             RowBox[{"-", 
              SqrtBox[
               FractionBox[
                RowBox[{
                 RowBox[{
                  RowBox[{"-", 
                   SuperscriptBox["Q", "2"]}], " ", 
                  SuperscriptBox["xk0", "2"]}], "-", 
                 FractionBox[
                  RowBox[{
                   SuperscriptBox["Q", "4"], " ", 
                   SuperscriptBox["xk0", "2"]}], 
                  SuperscriptBox[
                   RowBox[{"(", 
                    RowBox[{"Q", "+", "R"}], ")"}], "2"]], "-", 
                 FractionBox[
                  RowBox[{"2", " ", 
                   SuperscriptBox["Q", "3"], " ", "R", " ", 
                   SuperscriptBox["xk0", "2"]}], 
                  SuperscriptBox[
                   RowBox[{"(", 
                    RowBox[{"Q", "+", "R"}], ")"}], "2"]], "-", 
                 FractionBox[
                  RowBox[{
                   SuperscriptBox["Q", "2"], " ", 
                   SuperscriptBox["R", "2"], " ", 
                   SuperscriptBox["xk0", "2"]}], 
                  SuperscriptBox[
                   RowBox[{"(", 
                    RowBox[{"Q", "+", "R"}], ")"}], "2"]], "+", 
                 FractionBox[
                  RowBox[{"2", " ", 
                   SuperscriptBox["Q", "3"], " ", 
                   SuperscriptBox["xk0", "2"]}], 
                  RowBox[{"Q", "+", "R"}]], "+", 
                 FractionBox[
                  RowBox[{"2", " ", 
                   SuperscriptBox["Q", "2"], " ", "R", " ", 
                   SuperscriptBox["xk0", "2"]}], 
                  RowBox[{"Q", "+", "R"}]]}], 
                RowBox[{"R", " ", 
                 RowBox[{"(", 
                  RowBox[{"Q", "+", "R"}], ")"}]}]]]}], 
             RowBox[{
              RowBox[{"R", ">", "0"}], "&&", 
              RowBox[{"Q", ">", "0"}], "&&", 
              RowBox[{
               FractionBox[
                RowBox[{
                 RowBox[{"-", "Q"}], "-", "R"}], "Q"], "<", "xk0", "<", 
               FractionBox[
                RowBox[{"Q", "+", "R"}], "Q"]}]}]},
            {
             RowBox[{"-", 
              RowBox[{"\[Sqrt]", 
               RowBox[{"(", 
                RowBox[{
                 RowBox[{"1", "/", 
                  RowBox[{"(", 
                   RowBox[{"R", " ", 
                    RowBox[{"(", 
                    RowBox[{"Q", "+", "R"}], ")"}]}], ")"}]}], 
                 RowBox[{"(", 
                  RowBox[{
                   RowBox[{"-", 
                    SuperscriptBox["Q", "2"]}], "-", 
                   RowBox[{"2", " ", "Q", " ", "R"}], "-", 
                   SuperscriptBox["R", "2"], "+", 
                   RowBox[{"2", " ", 
                    SuperscriptBox["Q", "2"], " ", "xk0"}], "+", 
                   RowBox[{"2", " ", "Q", " ", "R", " ", "xk0"}], "-", 
                   RowBox[{
                    SuperscriptBox["Q", "2"], " ", 
                    SuperscriptBox["xk0", "2"]}], "+", 
                   FractionBox[
                    RowBox[{"Q", " ", 
                    RowBox[{"(", 
                    RowBox[{
                    SuperscriptBox["Q", "2"], "+", 
                    RowBox[{"2", " ", "Q", " ", "R"}], "+", 
                    SuperscriptBox["R", "2"], "-", 
                    RowBox[{"2", " ", 
                    SuperscriptBox["Q", "2"], " ", "xk0"}], "-", 
                    RowBox[{"2", " ", "Q", " ", "R", " ", "xk0"}], "+", 
                    RowBox[{
                    SuperscriptBox["Q", "2"], " ", 
                    SuperscriptBox["xk0", "2"]}]}], ")"}]}], 
                    RowBox[{"Q", "+", "R"}]], "+", 
                   FractionBox[
                    RowBox[{"R", " ", 
                    RowBox[{"(", 
                    RowBox[{
                    SuperscriptBox["Q", "2"], "+", 
                    RowBox[{"2", " ", "Q", " ", "R"}], "+", 
                    SuperscriptBox["R", "2"], "-", 
                    RowBox[{"2", " ", 
                    SuperscriptBox["Q", "2"], " ", "xk0"}], "-", 
                    RowBox[{"2", " ", "Q", " ", "R", " ", "xk0"}], "+", 
                    RowBox[{
                    SuperscriptBox["Q", "2"], " ", 
                    SuperscriptBox["xk0", "2"]}]}], ")"}]}], 
                    RowBox[{"Q", "+", "R"}]]}], ")"}]}], ")"}]}]}], 
             RowBox[{
              RowBox[{"R", ">", "0"}], "&&", 
              RowBox[{"Q", ">", "0"}], "&&", 
              RowBox[{"xk0", ">", 
               FractionBox[
                RowBox[{"Q", "+", "R"}], "Q"]}]}]},
            {
             RowBox[{"-", 
              RowBox[{"\[Sqrt]", 
               RowBox[{"(", 
                RowBox[{
                 RowBox[{"1", "/", 
                  RowBox[{"(", 
                   RowBox[{"R", " ", 
                    RowBox[{"(", 
                    RowBox[{"Q", "+", "R"}], ")"}]}], ")"}]}], 
                 RowBox[{"(", 
                  RowBox[{
                   RowBox[{"-", 
                    SuperscriptBox["Q", "2"]}], "-", 
                   RowBox[{"2", " ", "Q", " ", "R"}], "-", 
                   SuperscriptBox["R", "2"], "-", 
                   RowBox[{"2", " ", 
                    SuperscriptBox["Q", "2"], " ", "xk0"}], "-", 
                   RowBox[{"2", " ", "Q", " ", "R", " ", "xk0"}], "-", 
                   RowBox[{
                    SuperscriptBox["Q", "2"], " ", 
                    SuperscriptBox["xk0", "2"]}], "+", 
                   FractionBox[
                    RowBox[{"Q", " ", 
                    RowBox[{"(", 
                    RowBox[{
                    SuperscriptBox["Q", "2"], "+", 
                    RowBox[{"2", " ", "Q", " ", "R"}], "+", 
                    SuperscriptBox["R", "2"], "+", 
                    RowBox[{"2", " ", 
                    SuperscriptBox["Q", "2"], " ", "xk0"}], "+", 
                    RowBox[{"2", " ", "Q", " ", "R", " ", "xk0"}], "+", 
                    RowBox[{
                    SuperscriptBox["Q", "2"], " ", 
                    SuperscriptBox["xk0", "2"]}]}], ")"}]}], 
                    RowBox[{"Q", "+", "R"}]], "+", 
                   FractionBox[
                    RowBox[{"R", " ", 
                    RowBox[{"(", 
                    RowBox[{
                    SuperscriptBox["Q", "2"], "+", 
                    RowBox[{"2", " ", "Q", " ", "R"}], "+", 
                    SuperscriptBox["R", "2"], "+", 
                    RowBox[{"2", " ", 
                    SuperscriptBox["Q", "2"], " ", "xk0"}], "+", 
                    RowBox[{"2", " ", "Q", " ", "R", " ", "xk0"}], "+", 
                    RowBox[{
                    SuperscriptBox["Q", "2"], " ", 
                    SuperscriptBox["xk0", "2"]}]}], ")"}]}], 
                    RowBox[{"Q", "+", "R"}]]}], ")"}]}], ")"}]}]}], 
             RowBox[{
              RowBox[{"R", ">", "0"}], "&&", 
              RowBox[{"Q", ">", "0"}], "&&", 
              RowBox[{"xk0", "<", 
               FractionBox[
                RowBox[{
                 RowBox[{"-", "Q"}], "-", "R"}], "Q"]}]}]},
            {"Indeterminate", 
             TagBox["True",
              "PiecewiseDefault",
              AutoDelete->True]}
           },
           AllowedDimensions->{2, Automatic},
           Editable->True,
           
           GridBoxAlignment->{
            "Columns" -> {{Left}}, "ColumnsIndexed" -> {}, 
             "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
           
           GridBoxItemSize->{
            "Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, 
             "Rows" -> {{1.}}, "RowsIndexed" -> {}},
           GridBoxSpacings->{"Columns" -> {
               Offset[0.27999999999999997`], {
                Offset[0.84]}, 
               Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
               Offset[0.2], {
                Offset[0.4]}, 
               Offset[0.2]}, "RowsIndexed" -> {}},
           Selectable->True]}
        },
        GridBoxAlignment->{
         "Columns" -> {{Left}}, "ColumnsIndexed" -> {}, 
          "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
        GridBoxItemSize->{
         "Columns" -> {{Automatic}}, "ColumnsIndexed" -> {}, "Rows" -> {{1.}},
           "RowsIndexed" -> {}},
        GridBoxSpacings->{"Columns" -> {
            Offset[0.27999999999999997`], {
             Offset[0.35]}, 
            Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, 
          "Rows" -> {
            Offset[0.2], {
             Offset[0.4]}, 
            Offset[0.2]}, "RowsIndexed" -> {}}],
       "Piecewise",
       DeleteWithContents->True,
       Editable->False,
       SelectWithContents->True,
       Selectable->False]}]}], "}"}]}], "}"}]], "Output",
 CellChangeTimes->{{3.5948008420490437`*^9, 3.5948008614751463`*^9}, 
   3.59480091051939*^9}]
}, Open  ]]
},
WindowSize->{1224, 947},
WindowMargins->{{191, Automatic}, {0, Automatic}},
FrontEndVersion->"9.0 for Linux x86 (64-bit) (November 20, 2012)",
StyleDefinitions->"Default.nb"
]
(* End of Notebook Content *)

(* Internal cache information *)
(*CellTagsOutline
CellTagsIndex->{}
*)
(*CellTagsIndex
CellTagsIndex->{}
*)
(*NotebookFileOutline
Notebook[{
Cell[CellGroupData[{
Cell[579, 22, 2035, 60, 209, "Input"],
Cell[2617, 84, 1633, 26, 31, "Output"],
Cell[4253, 112, 1632, 26, 31, "Output"],
Cell[5888, 140, 1629, 26, 31, "Output"],
Cell[7520, 168, 1681, 28, 31, "Output"],
Cell[9204, 198, 1681, 28, 31, "Output"],
Cell[10888, 228, 1679, 28, 31, "Output"],
Cell[12570, 258, 1841, 34, 31, "Output"],
Cell[14414, 294, 1699, 28, 31, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[16150, 327, 1633, 37, 143, "Input"],
Cell[17786, 366, 1909, 32, 31, "Output"],
Cell[19698, 400, 1833, 29, 31, "Output"],
Cell[21534, 431, 2126, 40, 57, "Output"],
Cell[23663, 473, 2206, 45, 62, "Output"],
Cell[25872, 520, 2186, 42, 56, "Output"],
Cell[28061, 564, 1903, 31, 31, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[30001, 600, 3044, 71, 101, "Input"],
Cell[33048, 673, 1053, 27, 57, "Output"],
Cell[34104, 702, 9059, 249, 193, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[43200, 956, 1348, 35, 55, "Input"],
Cell[44551, 993, 27999, 729, 954, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[72587, 1727, 22251, 567, 969, InheritFromParent],
Cell[94841, 2296, 22283, 568, 957, "Output"]
}, Open  ]]
}
]
*)

(* End of internal cache information *)
